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
Nice find, this unfortunately stops us from using v13... We are using this feature to add request and response types to our express route handlers. It has been working very well for us for quite some time. Although, it would be nice if there were a way for us to reference the whole route as an interface and then dive into the query, body, response, etc from there. B/c we cannot reference the whole route we have to navigate the namespace four times for all our endpoints. See below:
exportconstpostLoginRoute: ApiEndpoint<apitypes.Login.LoginCreate.RequestParams,apitypes.Login.LoginCreate.RequestBody,apitypes.Login.LoginCreate.RequestQuery,apitypes.Login.LoginCreate.ResponseBody>=async(req,res)=>{constbody=req.body// this is correctly typed based on the OpenAPI spec.
...
res.send({...});// the parameter to send is conveniently validated against the generated response type};
Summary
It appears that swagger-typescript-api started ignoring the "--route-types" option from version 13.0.0.
Version
Reproduce
I created a sample project to reproduce this behavior.
https://codesandbox.io/p/sandbox/sleepy-golick-5zt4wz?file=%2Fpackage.json%3A25%2C32
npx sta -p oas.yaml --no-client --route-types
in terminal.Api.ts
has no routes typings.It seems internal variable
config.generateRouteTypes
cannot be set to true.The text was updated successfully, but these errors were encountered: