json-schema-to-typescript
json-schema-to-typescript copied to clipboard
Compile JSON Schema to TypeScript type declarations
Addresses #602 and #597
- Given a schema that contains a named definition (`Level2B`), - And that named definition is referenced in multiple locations, - And that named schema is also an intersection type...
In TypeScript, when `exactOptionalPropertyTypes` is set to true, properties that are `optional?:` but not do not include `| undefined` in their union can not be assigned a value of undefined....
## Enum generator creates invalid properties when value contain special characters ### Description When generating TypeScript enums from JSON Schema enums that contain special characters in some of their values,...
When the first character of the title is a number, the conversion fails. The following preview link reproduces. https://borischerny.com/json-schema-to-typescript-browser/#schema=%7B%0A%20%20%22type%22:%20%22object%22,%0A%20%20%22properties%22:%20%7B%0A%20%20%20%20%22android%22:%20%7B%0A%20%20%20%20%20%20%22type%22:%20%22object%22,%0A%20%20%20%20%20%20%22properties%22:%20%7B%0A%20%20%20%20%20%20%20%20%22version%22:%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22type%22:%20%22string%22,%0A%20%20%20%20%20%20%20%20%20%20%22title%22:%20%22%E7%89%88%E6%9C%AC%E5%8F%B7%22%0A%20%20%20%20%20%20%20%20%7D,%0A%20%20%20%20%20%20%20%20%22forceUpdate%22:%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22type%22:%20%22integer%22,%0A%20%20%20%20%20%20%20%20%20%20%22title%22:%20%221%E5%BC%BA%E6%9B%B40%E9%9D%9E%E5%BC%BA%E6%9B%B4%22%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D,%0A%20%20%20%20%20%20%22required%22:%20%5B%0A%20%20%20%20%20%20%20%20%22version%22,%0A%20%20%20%20%20%20%20%20%22forceUpdate%22%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%0A%20%20%7D,%0A%20%20%22required%22:%20%5B%0A%20%20%20%20%22android%22%0A%20%20%5D%0A%7D
Linked Issue: #627 This PR introduces a new `readonly` option. When enabled, this option generates all properties in interfaces as readonly, including nested objects and arrays.