This is a proof of concept module for a feature in Nuxt 3 that automatically infers and generates schema based on user provided configuration from several sources using unjs/untyped and supports extending layers.
Schema can be defined in nuxt.schema.ts or $schema field in nuxt.config.ts.
nuxt-config-schema as dev dependency:# npm
npm i -D nuxt-config-schema
# pnpm
pnpm add -D nuxt-config-schema
# yarn
yarn add nuxt-config-schema
nuxt.config:export default defineNuxtConfig({
modules: [
'nuxt-config-schema'
]
})
nuxt.schema.ts:export default defineNuxtConfigSchema({
appConfig: {
test2: {
$default: 'from nuxt.schema'
}
},
/** Config schema for another integration */
anotherConfig: {
aTest: '123'
}
})
nuxi dev or nuxi build commandsYou can access generated schema (json, markdown and types) from .nuxt/schema/ directory and also schema:resolved(schema) hook from other modules.
npm run dev:prepare to generate type stubs.npm run dev to start playground in development mode.We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.