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

Can I use net/http.Handler directly? #486

Open sir-farfan opened 1 month ago

sir-farfan commented 1 month ago

Hey there guys

We already have close to 100 http.Handler functions for the project, we'd like to use Huma for creating the non-existing OpenAPI documentation.

So far it looks like we'd need to rewrite the signature of all our handlers, which is not a small feat because of the volume.

Is there any other way we wrap our handlers with Huma for the documentation?

I was checking the Adapter interface, it also receives a Huma-Context but I didn't see a way to just get the request and response objects in order to write a wrapper function and just call our own directly...

If possible we'd like to do a few at a time instead of attempting to document the whole thing in a humongous PR.

Any ideas?