Skip to content

Conversation

@MuntasirSZN
Copy link

@MuntasirSZN MuntasirSZN commented Jul 26, 2025

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Upgrades from Zod v3 to v4 using native toJSONSchema() method, replacing the zod-to-json-schema dependency. toJsonSchema doesn't support dates, so had to go through that.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@vercel
Copy link

vercel bot commented Jul 26, 2025

@MuntasirSZN is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@MuntasirSZN
Copy link
Author

Maybe this should be a breaking change?

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jul 26, 2025

npm i https://pkg.pr.new/@nuxt/content@3482

commit: 3879b0f

- Replace complex post-processing with Zod v4's built-in override
callback
- Use target: 'draft-7' for proper nullable handling (anyOf instead of
oneOf)
- Handle dates with override callback for {type: "string", format:
"date-time"}
- Reduce implementation from ~100 lines to ~20 lines of processing
- Fix import paths from 'zod/v4/core' to 'zod/v4' across codebase
@farnabaz
Copy link
Member

farnabaz commented Aug 4, 2025

Thanks for the PR @MuntasirSZN
Indeed this will be a breaking change, what I like to do it use this opportunity to make Zod an optional dependency and allow users to use their preferred validation library. I'm thinking of introducing small helpers to make it possible.

Meanwhile I'll keep it PR pending so users can user Zod4 with PR release

npm i https://pkg.pr.new/@nuxt/content@3482

@MuntasirSZN
Copy link
Author

@farnabaz what about Standard Schema? I am happy to implement that.

@MuntasirSZN MuntasirSZN changed the title feat(zod): upgrade to Zod v4, remove zod-to-json-schema feat(zod)!: upgrade to Zod v4, remove zod-to-json-schema Aug 4, 2025
@farnabaz
Copy link
Member

farnabaz commented Aug 5, 2025

@farnabaz what about Standard Schema? I am happy to implement that.

AFAIK, The issue with standard schema is it does not expose schema and only expose unified validation. But I would be happy to see Standard Schema working in Nuxt Content

Norbiros added a commit to Hack4Krak/Hack4KrakSite that referenced this pull request Aug 16, 2025
We need nuxt/content#3482, to
resolve some very interesting issues while running vitest
on GitHub actions.
@Norbiros
Copy link

Maybe for now a compatibility layer could be added to fix #3462 without fully updating to zod v4?

Norbiros added a commit to Hack4Krak/Hack4KrakSite that referenced this pull request Aug 16, 2025
We need nuxt/content#3482, to
resolve some very interesting issues while running vitest
on GitHub actions.
test: add raw zod toJSONSchema passthrough tests (editor meta, nullable anyOf, union anyOf, intersection allOf)

chore: satisfy eslint for zod editor augmentation and tests

chore: lint and fix

chore: fix typo
@MuntasirSZN
Copy link
Author

Checkout #3524

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot start nuxt: Cannot read properties of undefined (reading 'id')

3 participants