sramam / typescript-json-schema

Generate json-schema from your Typescript sources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

typescript-json-schema

npm version Build Status

Generate json-schemas from your Typescript sources.

Features

  • Compiles your Typescript program to get complete type information.
  • Translates required properties, extends, annotation keywords, property initializers as defaults.

Usage

Node.js

  • Install with npm install typescript-json-schema -g
  • Generate schema from a typescript type: typescript-json-schema project/directory/tsconfig.json fully.qualified.type.to.generate

In case no tsconfig.json is available for your project, you can directly specify the .ts files (this in this case we use some built-in compiler presets):

  • Generate schema from a typescript type: typescript-json-schema "project/directory/**/*.ts" fully.qualified.type.to.generate

Background

Inspired and builds upon Typson, but typescript-json-schema is compatible with more recent Typescript versions. Also, since it uses the Typescript compiler internally, more advanced scenarios are possible.

About

Generate json-schema from your Typescript sources

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:TypeScript 99.8%Language:JavaScript 0.2%