markusahlstrand / tsoa-hono

A library that integrates the hono router with tsoa
MIT License
2 stars 2 forks source link

Are `Typechecked alternate responses?` supported? #9

Open hrueger opened 5 months ago

hrueger commented 5 months ago

Hi, are Typechecked alternate responses currently supported? Somehow, that parameter is always undefined for me...

And by the way, I had to patch the template file to work around this error: Cannot read property 'noImplicitAdditionalProperties' of undefined:

diff --git a/hono-router.hbs b/hono-router.hbs
index ca02e452df4707382a3262fd8c48802d4498c45e..da499118244c9b8880a5aa0c003fb788b5ae2107 100644
--- a/hono-router.hbs
+++ b/hono-router.hbs
@@ -57,7 +57,7 @@ const models: TsoaRoute.Models = {
     // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
     {{/each}}
 };
-const validationService = new ValidationService(models);
+const validationService = new ValidationService(models, { noImplicitAdditionalProperties: 'throw-on-extras' });

 // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
markusahlstrand commented 5 months ago

Thanks for the issue :) I hadn't actually seen this functionality before. We currently don't validate the responses, but it's something we should do.. I'll have to look in the koa template how it is handled there.

hrueger commented 5 months ago

That sounds great, thanks!

markusahlstrand commented 4 months ago

Hi @hrueger , I unfortunately haven't found the time to look at this. Due to that TSOA isn't supporting zod I have gradually switched over to using https://www.npmjs.com/package/@hono/zod-openapi instead and likely won't be doing more work on this repo.

hrueger commented 4 months ago

OK, no worries. Thanks for the update 👍