Skip to content

hungtcs/ts-json-schema-generator-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TS JSON Schema Generator Webpack Plugin

Auto generate JSON schema after build or after file change in watching mode.

Installation

npm install -D ts-json-schema-generator-webpack-plugin

Configuration

Note: Do not support tsconfig

export interface JSONSchemaGenerateWebpackPluginOptions extends Omit<Config, 'tsconfig'> {
  path: string;
  output: string;
}

More options see: https://github.com/vega/ts-json-schema-generator#options

Example

import JSONSchemaGenerateWebpackPlugin from 'ts-json-schema-generator-webpack-plugin';

module.exports = {
  // ...
  plugins: [
    // ...
    new JSONSchemaGenerateWebpackPlugin({
      type: 'Config',
      path: path.join(__dirname, './src/config/index.ts'),
      topRef: false,
      output: 'config.schema.json',
      additionalProperties: true,
    }),
  ],
};