0.0.3 • Published 3 years ago

@jjjzen/plugin-schema-to-typescript-dts v0.0.3

Weekly downloads
-
License
CC-BY-NC-ND-4.0
Repository
github
Last release
3 years ago

README

Build typescript definition (*.d.ts) from *.schema.json.

install

cd /path/your/project
npm install --save-dev @jjjzen/jjjzen @jjjzen/plugin-schema-to-typescript-dts

config

cd /path/your/project
vi .jjjzenrc.json
{
  "search": { "schemas": { "pattern": [ "**/*.schema.json" ] } },
  "plugins": [
    {
      "name": "@jjjzen/plugin-schema-to-typescript-dts",
      "options": {}
    }
  ]
}

build

cd /path/your/project
./node_modules/.bin/jjjzen
ls -al **/_build/*.d.ts

Tip jsdoc usage

/**
 * @typedef { import("./schemas/_build/xyz.in.schema").XyzInSchema } XyzInSchema 
 * @typedef { import("./schemas/_build/xyz.err.schema").XyzErrSchema } XyzErrSchema 
 * @typedef { import("./schemas/_build/xyz.out.schema").XyzOutSchema } XyzOutSchema 
 */

/**
 * @param { XyzInSchema } ajsonin 
 * @returns {Promise<(XyzOutSchema|XyzErrSchema)>}
 */

async function xyz(ajsonin) {
}