Skip to content

Conversation

@matthewp
Copy link
Contributor

@matthewp matthewp commented Dec 6, 2025

Description (required)

Adds Zod 4 under the "Dependency Upgrades" section.

Mostly just refers to the Zod 4's own migration guide.

Related issues & labels (optional)

For Astro version: 6.x. See astro PR #14956.

@astrobot-houston
Copy link
Contributor

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/upgrade-to/v6.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@netlify
Copy link

netlify bot commented Dec 6, 2025

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit f24ed9c
🔍 Latest deploy log https://app.netlify.com/projects/astro-docs-2/deploys/693432a7bbdf5c000879ad72
😎 Deploy Preview https://deploy-preview-12848--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@sarah11918 sarah11918 added the 6.0 label Dec 8, 2025
@sarah11918 sarah11918 added this to the v6.0.0 docs milestone Dec 8, 2025
@sarah11918
Copy link
Member

Thanks, @matthewp !

Also checking that none of these examples here where we describe using Zod for content collections look outdated to you? (This whole section on "Defining the collection schema" including the subsections for defining data types and collection references): https://deploy-preview-12322--astro-docs-2.netlify.app/en/guides/content-collections/#defining-datatypes-with-zod

We also do mention and show examples of Zod schemas on the actions page, but it's probably the two sections here about validation where we have text/examples that we should double check are still accurate for Zod 4: https://deploy-preview-12322--astro-docs-2.netlify.app/en/guides/actions/#using-validators-with-form-inputs

Lastly, even though Zod's migration guide shows everything, I would suspect there would be some changes that are common that most people would have to make to content collections schemas that are worth showing here, a way of focusing their attention on things that they'd very likely have to deal with. Can you suggest what some of those might be? If for example there were one or two things ONLY thing that will affect the majority of people, but maybe that's all they need to do, it would be much better for us to show those here. If it would be possible to help a number of people avoid needing to go to Zod's guide at all, then we really should do that.

@ArmandPhilippot
Copy link
Member

In addition to what Sarah just said, I noticed another change in the implementation regarding the use of the image() helper:

-heroImage: image().optional(),
+heroImage: z.optional(image()),

Does this mean that image() is no longer chainable with Zod 4? Does this also apply to reference()? Since both are specific to Astro, we might need to say something about them in our upgrade guide.

@matthewp
Copy link
Contributor Author

matthewp commented Dec 8, 2025

@sarah11918

Also checking that none of these examples here where we describe using Zod for content collections look outdated to you?

Yes, I wasn't sure if updating other docs was in scope for these PRs or not, since in the last one it was not. Happy to update other docs though, just tell me.

Lastly, even though Zod's migration guide shows everything, I would suspect there would be some changes that are common that most people would have to make to content collections schemas that are worth showing here, a way of focusing their attention on things that they'd very likely have to deal with. Can you suggest what some of those might be?

Not really, no. I can only say what was common in updating Astro itself, but I wouldn't presume that holds over to CC users. For example .default() was a bit of a problem for Astro but I don't know if users are going to need that a lot for CC (I wouldn't see a need for it personally). So I'd be afraid giving advice here would just be inaccurate. Perhaps when we have people upgrading it will reveal what's common?

@matthewp
Copy link
Contributor Author

matthewp commented Dec 8, 2025

@ArmandPhilippot

Does this mean that image() is no longer chainable with Zod 4? Does this also apply to reference()? Since both are specific to Astro, we might need to say something about them in our upgrade guide.

It should still be chainable, I'll check to confirm.

@sarah11918
Copy link
Member

Just noting that we're holding on this one as some aspects of the implementation PR might determine what kind of guidance is needed here!

@matthewp
Copy link
Contributor Author

matthewp commented Dec 9, 2025

@sarah11918 Which aspects? So I can unblock if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants