Get JSON Schema from TypeScript types without Generators/CLIs
Visit the official documentation for detailed information on how to use this library.
TypeScript: 4.1 or newer
While you use toJsonSchema
function from @ts-to-json-schema/core
to retrieve JSON schemas of your application types, the @ts-to-json-schema/transform
package
use TypeScript Compiler API to get information of these types, convert into JSON Schemas and
adds them to toJsonSchema
calls.
So you'll always need @ts-to-json-schema/core
(as main dependency) and @ts-to-json-schema/transform
(as dev dependency) packages.
npm install @ts-to-json-schema/core
npm install --save-dev typescript @ts-to-json-schema/transform ts-patch
Follow the instructions in the @ts-to-json-schema/core to know how to use the core function.