Closed Shahab96 closed 4 years ago
https://github.com/mtennoe/swagger-typescript-codegen/blob/master/templates/method.mustache#L70
Perhaps a check could be added here, and render void if the return type is undefined or null?
Yo! Hm, before we look into a fix, I am not sure this is a supported scenario in the Swagger spec? A request would have to have at least one response, for instance a 204, even for fire-and-forget requests? (I am not seeing any mention of it being either optional or required in the specs, but I would assume its mandatory)
You're right. Having at least one response is mandatory.
https://swagger.io/docs/specification/describing-responses/
Thank you!
I've found that if you have a swagger file where one or more of your operations has it's responses defined as an empty object, the generated api client returns
Promise
with no type, resulting in a TS error.Example:
Result:
Typescript requires that promises have some type eg Promise.
In this situation the type should be voice i.e