Open elliotnash opened 1 month ago
I'm not sure if that will help but I return a XLSX without any typing error using something like that:
.openapi(trailAllRoute, (ctx) => {
const trailList = new TrailList(trailsService.trails.values());
return ctx.body(trailList.encode().bytes(), 200, {
"Content-Type": "application/octet-stream"
})
})
I have a route that returns an object with a custom binary encoding. I want to use zod-openapi to document that route, but I'm having trouble with using Context.body() with an openapi route.
For reference, this is how I have my schema defined
And then my route is defined as
This gives an error that
Response is not assignable to type TypedResponse<{}, 200, string>
Casting the response toTypedResponse<Uint8Array, 200, string>
seems to work fine, but I'm wondering if there's a better built in way to serve binary data.