content icon indicating copy to clipboard operation
content copied to clipboard

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

Open maximepvrt opened this issue 9 months ago • 2 comments

Opening this issue after a quick discussion with @larbish on Discord.


💭 Context

In a project like nuxt-ui-pro/landing, we define content schemas using zod, like this : https://github.com/nuxt-ui-pro/landing/blob/main/content.config.ts

This type of schema is great for validating content and enabling autocompletion.
However, it quickly becomes redundant with the component prop definitions themselves (UPageHero, UPageFeatures, etc.).

✨ Idea

It would be great to allow an API like:

sections: z.array(z.component('UPageFeatures'))

Where the schema is automatically generated based on the component props.

This would eliminate the need to manually maintain Zod schemas for each component.

maximepvrt avatar Apr 16 '25 16:04 maximepvrt

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Jun 15 '25 16:06 github-actions[bot]

@farnabaz can you remove slate label ?

maximepvrt avatar Jun 15 '25 16:06 maximepvrt

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Aug 15 '25 21:08 github-actions[bot]