oapi-codegen icon indicating copy to clipboard operation
oapi-codegen copied to clipboard

gin server custom error handler option

Open chaseisabelle opened this issue 3 years ago • 7 comments

allows for a custom error handler option to the gin server code generation. default/existing behavior is preserved.

i really want my employer to use this tool going forward, but gin is a requirement, and is custom error handling.

Closes: https://github.com/deepmap/oapi-codegen/issues/584.

chaseisabelle avatar May 21 '22 04:05 chaseisabelle

bool return value vs error return value?

jxsl13 avatar May 21 '22 19:05 jxsl13

Well, the error is what the handler is handling, so it seems superfluous to return it back to the caller. Or am I misunderstanding what you mean?

chaseisabelle avatar May 21 '22 20:05 chaseisabelle

@deepmap-marcinr @jxsl13 Hey, all. Just a friendly checkup. Any update on this?

chase-isabelle-roostify avatar May 24 '22 15:05 chase-isabelle-roostify

I just had the thought that it might (or might not) make sense to return error values from the error handler in order to do whatever one wants to do with them, log, report, send somewhere, etc.

It's more or less a discussion topic, I'd guess that maybe someone might have a use case for returning an error instead of a bool.

If not, bool is fine.

jxsl13 avatar May 24 '22 15:05 jxsl13

@deepmap-marcinr Sorry to bug ya. Was just wondering if these changes might be good to go?

chaseisabelle avatar May 27 '22 17:05 chaseisabelle

I've been very busy, I'll take a look when I can


From: chase isabelle @.***> Sent: Friday, May 27, 2022 10:37 AM To: deepmap/oapi-codegen Cc: Marcin Romaszewicz; Mention Subject: Re: [deepmap/oapi-codegen] gin server custom error handler option (PR #587)

@deepmap-marcinrhttps://github.com/deepmap-marcinr Sorry to bug ya. Was just wondering if these changes might be good to go?

— Reply to this email directly, view it on GitHubhttps://github.com/deepmap/oapi-codegen/pull/587#issuecomment-1139865563, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALKC5DA4UEAANK6J26S5W6DVMEB5PANCNFSM5WRHSTRQ. You are receiving this because you were mentioned.Message ID: @.***>

deepmap-marcinr avatar May 27 '22 23:05 deepmap-marcinr

I've managed to mitigate this with custom templates: https://github.com/deepmap/oapi-codegen#making-changes-to-code-generation

chaseisabelle avatar Jul 07 '22 03:07 chaseisabelle

It would be nice if this gets implemented... What is holding it back atm? Mitigating it with custom templates is suboptimal and without all the built-in errors returns a different format than the spec that is loaded...

Let me know if I can help out.

jeroendk avatar Oct 27 '22 09:10 jeroendk

I've been super busy and not putting much work into oapi-codegen recently. All this needs is to have the conflict resolved. I'll see if I can have a look a little later today.

deepmap-marcinr avatar Oct 27 '22 16:10 deepmap-marcinr

Awesome, thanks!

jeroendk avatar Oct 28 '22 07:10 jeroendk