Using quicktype to infer a schema for untyped JSON responses from a 3rd party API
Hey folks! I'm currently dealing with untyped json responses from a 3rd party API and to add some layer of stability, I hacked on a quicktype extension together with @schickling to automatically infer a
With that I now have a folder of similar json responses and can run
quicktype is able to merge related json responses together, which is amazing.
I hope this will be helpful for anyone else dealing with a similar situation in the future!
Once the folks from quicktype merged this, you'll be able to use it in the web ide as well: https://app.quicktype.io/?l=ts
@effect/schema from the json responses! PR is open here, hopefully it'll get merged soon: https://github.com/quicktype/quicktype/pull/2312With that I now have a folder of similar json responses and can run
npx @timsuchanek/quicktype@23.0.8 -l typescript-effect-schema src/scrape_results -o src/types/api.ts -t ApiResult to get an up-to-date @effect/schema!quicktype is able to merge related json responses together, which is amazing.
I hope this will be helpful for anyone else dealing with a similar situation in the future!
Once the folks from quicktype merged this, you'll be able to use it in the web ide as well: https://app.quicktype.io/?l=ts
