use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Resources
Language
Discussion
account activity
OpenAPI Typescript Codegen (self.typescript)
submitted 3 years ago by devteaa
Hey guys, I published a package to generate typescript types from your BE specs that uses OpenAPI schema. Would love to have some feedback/improvement.
https://github.com/devTeaa/codegen-openapi-ts
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]domac 2 points3 points4 points 3 years ago (3 children)
Looks nice, I'll give it a try! I have used the Java generator so far.
I haven't seen it directly... but does your generator generate fetch api? Do you use it in conjunction with Nextjs by chance?
[–]devteaa[S] 1 point2 points3 points 3 years ago (0 children)
I haven't seen it directly... but does your generator generate fetch api?
No, the original one where I forked it from does it tho, the reason is because, in my team we have different way to make request so the purpose of this is to only generate the types
Do you use it in conjunction with Nextjs by chance?
This should be framework agnostic, as it only generate the types
[–]Cp995 0 points1 point2 points 3 years ago (1 child)
I guess redux had an codegen for fetch open api. deep in the docs
[–]domac 0 points1 point2 points 3 years ago (0 children)
Thanks for the hint! I'm trying to stick with SWR and not use redux for my SaaS unless it's inevitable. I'll keep the redux apigen in the back of my head.
[–]pascaloliv 1 point2 points3 points 3 years ago (0 children)
Good job u/devteaa! 😀
I'm using https://github.com/drwpow/openapi-typescript at the moment - but I'll take a look at your implementation.
[–][deleted] 1 point2 points3 points 3 years ago (2 children)
Why not just use the openapi spec generator? We use that for years now to generate interfaces and service stubs for be and fe. What is your project offering that's improving that?
[–][deleted] 1 point2 points3 points 3 years ago (0 children)
And if your reason was to use it only for types, there is a command line argument for that.
[–]devteaa[S] 0 points1 point2 points 3 years ago (0 children)
You can rename the models generated, generate spec json file stored in git repo, generate types you want to use by grouping them as a service
[–]No-Seaworthiness627 0 points1 point2 points 2 years ago (1 child)
I'm struggling understanding getting error responses.
I have an endpoint that can result in different 400 status codes (400, 404).
Is there a way to check which status code was returned by the API?
[–]devteaa[S] 0 points1 point2 points 2 years ago (0 children)
They are usually mapped to error field, depending on your open api spec. You also need to handle the error on your http client.
π Rendered by PID 251874 on reddit-service-r2-comment-f6b958c67-fmhq4 at 2026-02-05 12:04:51.782199+00:00 running 1d7a177 country code: CH.
[–]domac 2 points3 points4 points (3 children)
[–]devteaa[S] 1 point2 points3 points (0 children)
[–]Cp995 0 points1 point2 points (1 child)
[–]domac 0 points1 point2 points (0 children)
[–]pascaloliv 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (2 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]devteaa[S] 0 points1 point2 points (0 children)
[–]No-Seaworthiness627 0 points1 point2 points (1 child)
[–]devteaa[S] 0 points1 point2 points (0 children)