- Install yarn. https://yarnpkg.com/zh-Hans/
Install TypeScript globally [recommended way].yarn add global typescript
- Execute
yarn
oryarn install
in project root.
yarn run typescript-json-schema myString.ts MyString
result in stdout, add -o json.schema
to redirect to a file
Test example.ts (master branch) to generate json scheman, and use AJV to validate (in js/ts), interface: myString.ts
- Compile TypeScript to JavaScript,
yarn run build example.ts
- Test,
node example.js
, result in json.schema
Test example.ts (bdd branch) to generate json schema, and use python to validate, interface: myObject.ts
yarn run build example.ts
node example.js
pip install jsonschema
, it not installedpython test.py
to validate