@yzfe/ts-jsonschema-sync
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

ts-jsonschema-sync

监测 ts 的 interface 定义,一有改动,同步生成 json schema。

Monitor the interface definition of ts and generate JSON schema synchronously once there is any modification.

install

yarn add @yzfe/ts-jsonschema-sync

use

import { getTypeNames, getSchemaObject } from '@yzfe/ts-jsonschema-sync'
import * as path from 'path'

const rootPath = path.join(__dirname, 'typings')

const types = getTypeNames({
    rootPath
})

console.log(types)

console.log(JSON.stringify(getSchemaObject(types[0], {
    rootPath
}), null, 2))

/@yzfe/ts-jsonschema-sync/

    Package Sidebar

    Install

    npm i @yzfe/ts-jsonschema-sync

    Weekly Downloads

    7

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    39.7 kB

    Total Files

    7

    Last publish

    Collaborators

    • allenice
    • allenmo
    • vfasky