danielgtaylor / huma

Huma REST/HTTP API Framework for Golang with OpenAPI 3.1
https://huma.rocks/
MIT License
1.71k stars 134 forks source link

Humagin multiple API's per route group? #483

Open outofthisworld opened 1 month ago

outofthisworld commented 1 month ago

I'm just wondering how this should be set up, currently from the looks of things every time I want a new group e.g gin.Group('/resource') I have to register this with humagin using NewWithGroup().

I don't mind creating multiple API's, however it isn't clear to me how exactly I make this play nicely with docs and prefix the endpoints correctly.

Creating a config and modifying the config.Server causes a loading issue, so right now I have resorted to creating one api and then in all my endpoint registrations specifying the full path

cardinalby commented 4 weeks ago

You can use groups on Huma level instead of defining them on router level.

Check out a Huma registration wrapper for that

This way you operation will have correct auto-generated IDs and Summaries and you will have a single API instance