adk-go icon indicating copy to clipboard operation
adk-go copied to clipboard

Move restapi server controllers and routers to internal

Open dpasiukevich opened this issue 4 weeks ago • 3 comments

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 avatar Dec 11 '25 10:12 dpasiukevich

@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)?

Kenasvarghese avatar Dec 12 '25 18:12 Kenasvarghese

@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 .

kdroste-google avatar Dec 15 '25 10:12 kdroste-google

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.

Kenasvarghese avatar Dec 15 '25 16:12 Kenasvarghese