frontend icon indicating copy to clipboard operation
frontend copied to clipboard

[Feature] Generate API TS types from OpenAPI/Swagger

Open kachar opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. Supporting and maintaining types manually on the frontend is troublesome and leads to runtime errors

Describe the solution you'd like Generate the typescript types based on the swagger/openapi spec that we automatically export from the API

Consider the following tools:

  • https://github.com/drwpow/openapi-typescript

Describe alternatives you've considered Generate types based on Prisma schema - not consistent with the actual API responses, just provides DB schema

kachar avatar Mar 26 '22 22:03 kachar

npx openapi-typescript http://localhost:5010/docs-json --output defs.ts
npx openapi-typescript https://dev.podkrepi.bg/docs-json --output defs.ts

Sample output: https://gist.github.com/kachar/500d1d018a0e2d0c2e58733b5285be89

kachar avatar Mar 26 '22 23:03 kachar

cc @dimitur2204

kachar avatar Nov 24 '22 13:11 kachar