Skip to content

🟠 init --api grpc|graphql ignored — always generates a REST/HTTP server & handlers #43

Description

@sazardev

Severity: 🟠 HIGH — --api grpc / --api graphql is ignored; project is always a REST/HTTP server

goca init --api grpc (and --api graphql) does not change the generated architecture. The generated cmd/server/main.go always builds a REST HTTP server (mux.NewRouter() + http.Server), and goca feature in such a project always generates an HTTP handler — never gRPC/GraphQL.

Reproduction

goca init api_grpc --module github.com/test/api_grpc --api grpc
grep -c mux api_grpc/cmd/server/main.go         # -> uses mux.NewRouter() (REST)
cd api_grpc
goca feature Thing --fields "x:int"
ls internal/handler/                            # -> http/thing_handler.go  (not grpc)

Actual result

  • cmd/server/main.go uses router := mux.NewRouter() and &http.Server{...} for --api grpc.
  • feature produces internal/handler/http/thing_handler.go (HTTP), with no .proto / gRPC server.
  • Same for --api graphql: HTTP handler only.

The standalone goca handler Gadget --type grpc does generate internal/handler/grpc/gadget.proto, so gRPC generation exists but is unreachable from the --api project setting and from feature.

Expected

--api grpc should scaffold a gRPC server in main.go and make feature default its handler to gRPC (likewise GraphQL). At minimum the configured API type must drive feature's handler type. Otherwise the --api flag is misleading.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions