Move restapi server controllers and routers to internal
Ideally we should only expose func NewHandler(config *launcher.Config) http.Handler.
Keeping controllers/routers internally gives us more flexibility to refactor/update code. And keeping controller/routers public looks excessive.
@dpasiukevich I’d like to contribute to this issue. Since it’s my first time contributing to this project, I want to confirm that I’m understanding the goal correctly. Is the intention to move the adkrest/controllers and adkrest/internal/routers logic into the same package as NewHandler, so they can be unexported and the only public API remains NewHandler(config *launcher.Config)?
@dpasiukevich I’d like to contribute to this issue. Since it’s my first time contributing to this project, I want to confirm that I’m understanding the goal correctly. Is the intention to move the adkrest/controllers and adkrest/internal/routers logic into the same package as NewHandler, so they can be unexported and the only public API remains NewHandler(config *launcher.Config)?
Hi, @Kenasvarghese, yes, the idea is to hide as much as possible. It would be great if you could contribute!
Please mind that "internal" directory is exactly what's needed - please see docs .
Update: routers was already under adkrest/internal.
While moving adkrest/controllers under adkrest/internal/, I noticed that
EncodeJSONResponse (defined in controllers/handler.go) is currently used
by webui, which lives outside the internal tree. This creates a Go internal visibility conflict.
My plan is to extract EncodeJSONResponse into a shared helper package
(e.g., adkrest/response) that both adkrest and webui can import,
while keeping controllers internal. NewHandler(config *launcher.Config) http.Handler
will remain the only public API of adkrest.
@kdroste-google Looking for guidance on the intended API boundary before continuing.