Skip to content

Guidewire/ts-to-json-schema-tests

Repository files navigation

Generating JSON Schema from TypeScript types

Test JSON Schema generation libraries capabilities.

The purpose of this repository is to show if different TypeScript to JSON Schema generating libraries can handle anything more complicated.

Testing approach

In src directory are the library sources to be generated. There are 2 types tests:

  • simple.ts contains very simple tests case without any external libraries
  • index.tsx contains example React component with many different possible React types (from typescript-cheatsheets)

For each tested package, there is generator script in generators directory. To run it use:

yarn generate:<tested-package-name>

The generator should generate types for Simple and ExampleProps types. Output will be stored in schemas directory if generation succeeded under following format:

<tested-package-name>-<type-name>.json

Installation

Install dependencies using yarn.

yarn

Results

Library Command Simple ExampleProps
typescript-json-schema yarn generate:typescript-json-schema
ts-json-schema-generator yarn generate:ts-json-schema-generator
quicktype yarn generate:quicktype

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published