Skip to content

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

Open
@maximepvrt

Description

@maximepvrt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions