You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ColinEberhardt
changed the title
Research the pros / cons of openapi-typescript
Research the pros / cons of openapi-typescript / swagger-typescript-api
Mar 2, 2023
We've used swagger-typescript-api on several projects on client and have generally been pretty happy with it. Not compared it to openapi-typescript so not sure what the pros and cons are of one vs the other but I can give some things we like and don't like about it:
Good:
Generated API code and request and response codes work really well (assuming you've got a good swagger spec), particularly being able to define enum types for fields.
Support for async and throwing errors on request failures makes for a nice clean interface, and adding the response body to an error is really helpful if you're sending back relevant info in the error response
Good CLI interface makes it easy to hook into postinstall npm hooks
Relatively easy to customise by linking in templates (handy when we had to fix a bug with uploading multiple files in one request)
Bad:
Doesn't clean out classes for schemas or requests that have been removed from the swagger. There is a clean option but it just seems to remove everything and not regenerate it, not sure if intentional or a bug but definitely an annoyance.
Uploading multiple files with fetch was a little buggy, might be fixed by now
There are some a TypeScript-specific generators:
It's worth doing a bit of research on these solutions, what features do they offer that the forge lacks? pros / cons?
The text was updated successfully, but these errors were encountered: