Skip to content

Fix union schema extend regression - #4095

Merged
HiDeoo merged 1 commit into
withastro:mainfrom
HiDeoo:hd/fix-doc-schema-extend-union
Jul 28, 2026
Merged

HiDeoo merged 1 commit into
withastro:mainfrom
HiDeoo:hd/fix-doc-schema-extend-union

Conversation

@HiDeoo

@HiDeoo HiDeoo commented Jul 24, 2026

Copy link
Copy Markdown
Member

Description

This PR fixes a regression introduced in #3936 for an edge case I definitely didn't think about: using a union to extend the docs schema.

To address this, after unwrapping (optional, nullable, etc.) the user-provided schema, we need to check if it's a union and if it is, we deep-merge each member of the union with the default schema.

@changeset-bot

changeset-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: afa713c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit afa713c
🔍 Latest deploy log https://app.netlify.com/projects/astro-starlight/deploys/6a63f551e17cc7000878bb9e
😎 Deploy Preview https://deploy-preview-4095--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the 🌟 core Changes to Starlight’s main package label Jul 24, 2026
@sarah11918
sarah11918 marked this pull request as ready for review July 27, 2026 15:11

@delucis delucis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it’s even the approach we use for Astro’s docs, so very good to fix 😄

Thanks for taking care of this @HiDeoo 💜

@HiDeoo

HiDeoo commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

Oh, it’s even the approach we use for Astro’s docs, so very good to fix 😄

I totally forgot about that. Before merging, I'll try this branch against the docs to make sure I don't spot anything else while at it.

@HiDeoo

HiDeoo commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

Confirmed updating Astro Docs to v0.41.4 introduces a type error on the docs schema and fails to build.

Using the version from this PR fixes both the type error and the build issue.

@HiDeoo
HiDeoo merged commit bb06434 into withastro:main Jul 28, 2026
17 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Jul 28, 2026
dadezzz pushed a commit to dadezzz/university_notes that referenced this pull request Aug 1, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [@astrojs/starlight](https://starlight.astro.build) ([source](https://github.com/withastro/starlight/tree/HEAD/packages/starlight)) | [`0.41.4` → `0.41.5`](https://renovatebot.com/diffs/npm/@astrojs%2fstarlight/0.41.4/0.41.5) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@astrojs%2fstarlight/0.41.5?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@astrojs%2fstarlight/0.41.4/0.41.5?slim=true) |

---

### Release Notes

<details>
<summary>withastro/starlight (@&#8203;astrojs/starlight)</summary>

### [`v0.41.5`](https://github.com/withastro/starlight/blob/HEAD/packages/starlight/CHANGELOG.md#0415)

[Compare Source](https://github.com/withastro/starlight/compare/@astrojs/starlight@0.41.4...@astrojs/starlight@0.41.5)

##### Patch Changes

- [#&#8203;4095](withastro/starlight#4095) [`bb06434`](withastro/starlight@bb06434) Thanks [@&#8203;HiDeoo](https://github.com/HiDeoo)! - Fixes a regression when using a union to [extend](https://starlight.astro.build/reference/frontmatter/#extend) Starlight’s `docsSchema()`.

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yODEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjI4MS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
HiDeoo added a commit to HiDeoo/starlight that referenced this pull request Aug 16, 2026
* main: (219 commits)
  i18n(fr): update `authoring-content.mdx`, `i18n.mdx` & `plugins.md` (withastro#4128)
  i18n(de): update links to Astro docs (withastro#4126)
  Update `size-limit` config (withastro#4122)
  Replace 3 outdated links to Astro Docs (withastro#4120)
  [ci] release (withastro#4115)
  Update dependencies (withastro#4113)
  Add Astro LilyPond to Starlight showcase (withastro#4116)
  Refactor Sätteri RTL code support plugin (withastro#4114)
  Use pinned version of `pkg-pr-new` for preview releases (withastro#4111)
  chore(deps): update vite and rolldown (withastro#4108)
  i18n(ru): update translations (withastro#4107)
  [ci] release (withastro#4106)
  Add Forgejo icon (withastro#4102)
  [ci] format
  i18n(de): update `themes.mdx` (withastro#4104)
  i18n(de): update `plugins.mdx` (withastro#4103)
  i18n(de): update `community-content.mdx` (withastro#4101)
  [ci] release (withastro#4097)
  Fix union schema `extend` regression (withastro#4095)
  [ci] release (withastro#4090)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌟 core Changes to Starlight’s main package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docsSchema({ extend }) doesn't support ZodUnion

2 participants