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
Similar to #1123 - which has been closed because of the ability to handle this in openapi-fetch as I read it? - I'd like to be able to actually have the request typed properly.
Sorry if I missed a point from the mentioned issue that explains why this would not be preferable in openapi-typescript itself. From my POV it seems like the issue has been closed prematurely as afaik it's not possible to have the correct types without openapi-fetch?
So yeah there are 2 parts here: for openapi-fetch and #1123 we’re limited in what we can do because of the design goal / design curse we originally had of using only generics. So that means openapi-fetch really has no clue what any of your schema is at runtime. We can try and guess based on request, etc., but even if your type was File that wouldn’t change openapi-fetch’s handling of requests unless you overrode it.
We’re looking to revisit a lot of these papercuts in 1.0, because they’re all valid! And we’re hearing a lot of great input (yours included) that people would like a little runtime awareness in openapi-fetch. At least a little more than exists currently.
But for your question about openapi-typescript, we do have the transformer API that’s meant expressly for your usecase. We don’t want to assume you want File because some may want Buffer, some may want Blob, etc. Also depending on whether you’re generating types for the client or server you’ll want different things as well. We’re not open to changing the default behavior at this time.
Note that we’re considering adding a config file in an upcoming, because using the transform API requires you run it in a Node.js script, which can be a bit of a hassle. But regardless, that’s exactly what you need!
Description
Similar to #1123 - which has been closed because of the ability to handle this in openapi-fetch as I read it? - I'd like to be able to actually have the request typed properly.
Proposal
E.g. for
I'd like a generated type like
Sorry if I missed a point from the mentioned issue that explains why this would not be preferable in openapi-typescript itself. From my POV it seems like the issue has been closed prematurely as afaik it's not possible to have the correct types without openapi-fetch?
Extra
The text was updated successfully, but these errors were encountered: