Skip to content

Generate clients under gen and add OpenAPI spec - #4

Merged
msdmazvoid merged 2 commits into
mainfrom
feature/clients
Nov 7, 2026
Merged

msdmazvoid merged 2 commits into
mainfrom
feature/clients

Conversation

@msdmazvoid

@msdmazvoid msdmazvoid commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds generated clients and an OpenAPI document for the kouja agent API, all under gen/.

  • Adds protoc-gen-kouja-client, a small protoc plugin that generates gen/client/client.gen.go from the proto google.api.http annotations.
  • The generated client provides typed gRPC and HTTP/JSON methods for every VolumeService and AdminService RPC.
  • Adds mTLS helpers (LoadTLSConfig, NewGRPCFromFiles, NewHTTPFromFiles) and request-ID propagation across both transports.
  • Maps grpc-gateway HTTP errors to *client.Error with GRPCStatus() so status.Code works for both transports.
  • Generates gen/openapi/openapi.swagger.json (OpenAPI 2.0) via protoc-gen-openapiv2 and adds the pinned tool to make tools.
  • Adds proto/openapi.yaml for the generated document title, version, description, and HTTPS scheme.
  • Adds client documentation in docs/clients.md and a short README section.
  • Adds unit and gateway-compatibility tests covering all HTTP routes, gRPC wiring, TLS loading, request IDs, error mapping, and the generated OpenAPI operations.

Generation

make tools
make proto

make proto now emits:

  • gen/kouja/v1/* — protobuf, gRPC stubs, and grpc-gateway
  • gen/client/client.gen.go — typed gRPC + HTTP client
  • gen/openapi/openapi.swagger.json — OpenAPI 2.0 document

Validation

  • go build ./...
  • go vet ./...
  • go test -tags=unit ./...
  • golangci-lint run
  • make proto (idempotent; no diff in generated output)
  • HTTP client paths, query parameters, and JSON bodies verified against the real generated grpc-gateway mux in gen/client/gateway_test.go

voidstarit added 2 commits November 6, 2026 20:43
Generate a merged OpenAPI 2.0 document from the proto HTTP annotations and add a client package that wraps the generated gRPC stubs and HTTP/JSON gateway. The new clients provide mTLS helpers, request-ID propagation, typed methods for every volume and admin RPC, and grpc-gateway error mapping.
Replace the hand-written client package with a protoc plugin that emits gen/client/client.gen.go from the proto google.api.http annotations. The generated client keeps the typed gRPC and HTTP APIs, mTLS helpers, request-ID propagation, and error mapping, while making gen/client reproducible through make proto.
@msdmazvoid msdmazvoid changed the title Add typed clients and generated OpenAPI spec Generate clients under gen and add OpenAPI spec Nov 7, 2026
@msdmazvoid
msdmazvoid merged commit 84b7082 into main Nov 7, 2026
2 checks passed
@msdmazvoid
msdmazvoid deleted the feature/clients branch November 7, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant