mongodb-json-schema-to-typescript
Transform MongoDB-compliant JSON Schema files to TypeScript.
On top of json-schema-to-typescript
, it supports bsonType
values, including date
.
This fork also supports some bsonType
types: Date
or fallback to usual values for type
.
Example
Input:
Output:
CLI
A CLI utility is provided with this package.
npx mongodb-json-schema-to-typescript foo.json > foo.d.ts
Tests
npm test
Further Reading
- Original implementation: https://github.com/bcherny/json-schema-to-typescript
- JSON-schema spec: https://tools.ietf.org/html/draft-zyp-json-schema-04
- JSON-schema wiki: https://github.com/json-schema/json-schema/wiki
- JSON-schema test suite: https://github.com/json-schema/JSON-Schema-Test-Suite/blob/node
- TypeScript spec: https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md