bcherny/json-schema-to-typescript
View on GitHub ↗ ★ 3,350 TypeScript
Compile JSON Schema to TypeScript type declarations
13 mentions on Hacker News by 6 people: 1 story, 12 comments · first 2016-05-19 · latest 2023-10-06
20082026
-
…that don’t adhere to the spec, etc. Feel free to check out the tests to understand some of these: https://github.com/bcherny/json-schema-to-typescript (shameless plug — I have maintained this library for a number of years).
comment by bcherny · 2023-10-06 · in Show HN: A tool to Convert JSON schemas into TypeScript Deno classes -
…consistent interface, and almost every language has a reasonably up-to-date validation library. [1] https://github.com/bcherny/json-schema-to-typescript
comment by whacked_new · 2022-06-08 · in Why JSON Isn’t A Good Configuration Language (2018) -
Take a look at https://github.com/bcherny/json-schema-to-typescript , too. I used it successfully at a previous job. IIRC, I had to write some code to convert OpenAPI to JSON Schema but it wasn’t onerous
comment by goodoldneon · 2022-05-22 · in Show HN: Remult – a CRUD framework for full-stack TypeScript -
If you're using OpenAPI, you could use this to generate TypeScript interfaces: https://github.com/bcherny/json-schema-to-typescript It works really well
comment by goodoldneon · 2022-05-06 · in TRPC: End-to-end typesafe APIs made easy -
…possible, though I don't know how strictly they map to/from each other. JSON schema to TypeScript - https://github.com/bcherny/json-schema-to-typescript TypeScript to JSON schema - https://github.com/YousefED/typescript-json-schema
comment by lioeters · 2020-07-30 · in Schemastore.org – schemas for all commonly known JSON file formats -
…achieved run-time type checking in TypeScript. In this case, it was done by code generation using: https://github.com/bcherny/json-schema-to-typescript Personally, I'd prefer a way that doesn't involve another build step. A popular library…
comment by lioeters · 2019-09-18 · in Validating Data with JSON Schema, Angular and TypeScript -
…undefined to explicit types Or, use —strict to do both of those and more. Example tsconfig.json: https://github.com/bcherny/json-schema-to-typescript/blob/ma... Btw, what specifically is indecent about TS’s type guards?
comment by bcherny · 2019-01-16 · in Migrate Jest to TypeScript -
…Or you could define your types using something like JSON Schema and validate against that. https://github.com/bcherny/json-schema-to-typescript https://github.com/YousefED/typescript-json-schema
comment by styfle · 2017-08-09 · in JavaScript for People Who Hate JavaScript -
…are described in the separate JSONPointer spec [0]. See unit tests for examples: - In-file $ref: https://github.com/bcherny/json-schema-to-typescript/blob/ma... - Local $ref: https://github.com/bcherny/json-schema-to-typescript/blob/ma...…
comment by bcherny · 2017-04-26 · in Show HN: JSONSchema to TypeScript compiler -
…but comments seem like a solid stopgap. Especially because they show up as tooltips in VSCode. [0] https://github.com/bcherny/json-schema-to-typescript/issues/...
comment by bcherny · 2017-04-26 · in Show HN: JSONSchema to TypeScript compiler -
▲ 72
Show HN: JSONSchema to TypeScript compilerstory by bcherny · 2017-04-25 · 34 comments
-
…e.g. validating an entry via RegEx. It tends to make APIs safer and runtime errors more clear. [1] https://github.com/bcherny/json-schema-to-typescript [2] https://github.com/YousefED/typescript-json-schema
comment by whatever_dude · 2017-04-11 · in TypeScript at Slack -
Ha! That's the reason I started working on https://github.com/bcherny/json-schema-to-typescript . For the record, JSON Schemas are quite a bit more expressive than TypeScript interfaces, or even Scala Traits. I actually put together a big…
comment by bcherny · 2016-05-19 · in Specifying JSON