json-schema-to-typescript
json-schema-to-typescript copied to clipboard
Compile JSON Schema to TypeScript type declarations
In AOS 3 there's provision for `oneOf` being used along with a `discriminator`, which allows specifying an array where the types are discriminated based on a property. https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/ ``` {...
### How to reproduce I copied the below snippet and pasted in package json ```javascript { "scripts": { "compile-schemas": "json2ts -i src/**/*.schema.json" } } ``` My project folder structure is...
See https://github.com/bcherny/json-schema-to-typescript/pull/144#discussion_r167442887 cc @qix
Is it possible to support a custom index definition for `additionalProperties`? Currently the output is: `[k: string]: MyInterface`. It would be beneficial if it could be customized like so `[k...
Can I prevent reference type from expansion? Input JSON: ```json { "properties": { "correct": { "$ref": "#/definitions/color" }, "wrong": { "description": "should be referenced", "$ref": "#/definitions/color" } }, "additionalProperties": false,...
I am testing `json-schema-to-typescript` and I see that in some cases it produces `interface` and in other cases `type`. What is the rule here, when does it make which? Is...
Forgive me if this is a duplicate of https://github.com/bcherny/json-schema-to-typescript/issues/132 or another issue; I searched by didn't find anything. I was hoping to be able to have both a comment about...
There are some points where `tsEnumNames` could be enhanced: - JSON is ~~usually~~ often `snake_case`. Allow ts_enum_names. - JSON Editor uses `enum_titles` for a [similar scenario](https://github.com/jdorn/json-editor#editor-options). Allow both or adopt....
adds the option to use an url as input to the CLI - uses `validator.isURL()` to test if the input is a valid fully qualified URL. - uses `axios` to...
Both the following schemas ``` { "$schema": "http://json-schema.org/draft-07/schema#", "title": "Empty", "type": "object", "additionalProperties": false } ``` ``` { "$schema": "http://json-schema.org/draft-07/schema#", "title": "Empty", "type": "object", "additionalProperties": false, "properties": { } }...