Vite-plugin-type-to-schema
Plugin that converts types to JSON Schemas just via suffixed import
💿 Installation
pnpm i -D vite-plugin-type-to-schema # (or npm instead of pnpm)
# or
yarn add vite-plugin-type-to-schema --dev
👀 Usage
import typeToSchema from 'vite-plugin-type-to-schema';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [typeToSchema()]
});
⚙️ Options
Source
name(optionality): defaultValue // Description
typeToSchema({
suffix?: '?schema'
dts?: 'schemas.d.ts'
options?: {}
})
📃 Details
See this test and fixture to learn behaviour of schema compiling