danielgtaylor/huma

Adding openapi command still emits router config

Closed this issue · 2 comments

Hi,

Just really after some guidance on this issue. I've added the openapi command as per the docs:

https://huma.rocks/tutorial/client-sdks/

In my case I'm using the gin router.

Because the router needs to be initialised in order to add the routes and then run the openapi command, the command actually emits all the gin debug too.

Is this expected behaviour or is there a way I can prevent this?

I guess I could use a different router initially and then set up the real one in the hooks?

Any feedback greatly appreciated.

Many thanks.

@darrenparkinson you can try putting gin.SetMode(gin.ReleaseMode) into your main.go to prevent that debug output, otherwise you may have to filter it out. I think this is specific to Gin.

Cool. That’s what I was thinking. Just wasn’t sure if I was missing something. I’m thinking about switching to the new std library routing for this API tbh, so that should help.