UNPKG

1.29 kBMarkdownView Raw
1# typescript-json-schema
2
3[![npm version](https://img.shields.io/npm/v/typescript-json-schema.svg)](https://www.npmjs.com/package/typescript-json-schema) [![Build Status](https://travis-ci.org/YousefED/typescript-json-schema.svg?branch=master)](https://travis-ci.org/YousefED/typescript-json-schema)
4
5Generate json-schemas from your Typescript sources.
6
7## Features
8* Compiles your Typescript program to get complete type information.
9* Translates required properties, extends, annotation keywords, property initializers as defaults.
10
11## Usage
12
13### Node.js
14
15* Install with `npm install typescript-json-schema -g`
16* Generate schema from a typescript type: `typescript-json-schema project/directory/tsconfig.json fully.qualified.type.to.generate`
17
18In 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):
19
20* Generate schema from a typescript type: `typescript-json-schema "project/directory/**/*.ts" fully.qualified.type.to.generate`
21
22## Background
23Inspired and builds upon [Typson](https://github.com/lbovet/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.