Skip to content

feat: inherit component prop types in content collection #3451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

farnabaz
Copy link
Member

@farnabaz farnabaz commented Jul 10, 2025

πŸ”— Linked issue

resolves #3314

❓ 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

Thanks to nuxtlabs/nuxt-component-meta#84, content collections can now inherit their schema from a component's props.

  const buttons = defineCollection({
    type: 'data',
    source: 'buttons/**',
    schema: z.component('@nuxt/ui/components/Button.vue'),
  })

This is a long-planned feature designed to enhance and simplify content collections. It is also part of a larger plan to move collections away from being dependent on Zod and make them validation-library-agnostic, allowing users to use their preferred validation library.

Copy link

vercel bot commented Jul 10, 2025

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated (UTC)
content-docs βœ… Ready (Inspect) Visit Preview Jul 10, 2025 0:58am

Copy link

cloudflare-workers-and-pages bot commented Jul 10, 2025

Deploying content with Β Cloudflare Pages Β Cloudflare Pages

Latest commit: 101ed8d
Status:Β βœ…Β  Deploy successful!
Preview URL: https://218ac462.content-f0q.pages.dev
Branch Preview URL: https://feat-component-schema.content-f0q.pages.dev

View logs

Copy link

pkg-pr-new bot commented Jul 10, 2025

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

commit: 101ed8d

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.

[DX] Automatically generate schemas from component props in content.config.ts
1 participant