bcherny/json-schema-to-typescript

Add setting to validate input schema before proceeding with compile

darcyparker opened this issue · 3 comments

As a user I sometimes have invalid JSON schema and I would like a debugging option to tell me my schema is invalid so I don't waste time looking for issues in how JSON Schema is compiled to TS interface definition. As well, I want to be confident my JSON schema is valid before filing an issue.

A rough WIP is here: https://github.com/darcyparker/json-schema-to-typescript/tree/validateJSONSchema

An additional nice to have feature would be to log warnings about cases of not-expressible to typescript and suggest using decorators as mentioned here: #8

Although I have a rough WIP. I am open to discussing alternatives... and/or the need of this feature.

As a user I sometimes have invalid JSON schema and I would like a debugging option to tell me my schema is invalid

Agreed that this is a good idea. Can we use something off the shelf like https://www.npmjs.com/package/json-schema-validation or https://www.npmjs.com/package/json-schema-validator?

An additional nice to have feature would be to log warnings about cases of not-expressible to typescript

Also would be great. This should be as simple as traversing the tree for blacklisted keywords.

Thanks for reviewing and suggestion of off the shelf validator. That's better than what I was trying.