8000 Generate go apis by npolshakova · Pull Request #106 · agentgateway/agentgateway · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Generate go apis #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025
Merged

Generate go apis #106

merged 1 commit into from
May 16, 2025

Conversation

npolshakova
Copy link
Collaborator

Add a generate-go Makefile target to simplify generating Go structs from protobuf API definitions. This target helps Go-based control plane components consume API types without needing manual protoc invocation in the control plane repo.

@Copilot Copilot AI review requested due to automatic review settings May 9, 2025 19:55
8000 Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new Makefile target to streamline generating Go structs from protobuf API definitions so that Go-based control plane components can consume API types without manual protoc invocation.

  • Adds generated Go code for API definitions in go/api/a2a
  • Updates proto files with go_package options for proper import paths
  • Modifies a string literal in the xDS client and introduces the generate-apis target in the Makefile

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
go/api/a2a/a2a/target.pb.go Generated Go API code from protobuf definitions
go.mod Module definition added with Go version specification
crates/agentgateway/src/xds/client.rs Updated role string format in API client configuration
crates/agentgateway/proto/*.proto Added go_package options to ensure consistent Go code generation
Makefile New generate-apis target to automate protobuf code generation
Comments suppressed due to low confidence (1)

crates/agentgateway/src/xds/client.rs:294

  • [nitpick] The updated role string differs from the previous naming convention. Please verify that this change is intentional and consistent with naming used across the system.
"agentgateway-api~{ns}~{name}",

Comment on lines +54 to +67
protoc --proto_path=./crates/agentgateway/proto/ \
--go_out=./go/api/a2a \
--go_opt=paths=source_relative \
--go_opt=Mcommon.proto=github.com/agentgateway/go/api/common \
./crates/agentgateway/proto/a2a/target.proto
protoc --proto_path=./crates/agentgateway/proto/ \
--go_out=./go/api/mcp \
--go_opt=paths=source_relative \
--go_opt=Mcommon.proto=github.com/agentgateway/go/api/common \
./crates/agentgateway/proto/mcp/target.proto
protoc --proto_path=./crates/agentgateway/proto/ \
--go_out=./go/api \
--go_opt=paths=source_relative \
./crates/agentgateway/proto/listener.proto
Copy link
Preview
Copilot AI May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider refactoring the repeated protoc arguments into variables or a helper script to reduce duplication and simplify future updates.

Suggested change
protoc --proto_path=./crates/agentgateway/proto/ \
--go_out=./go/api/a2a \
--go_opt=paths=source_relative \
--go_opt=Mcommon.proto=github.com/agentgateway/go/api/common \
./crates/agentgateway/proto/a2a/target.proto
protoc --proto_path=./crates/agentgateway/proto/ \
--go_out=./go/api/mcp \
--go_opt=paths=source_relative \
--go_opt=Mcommon.proto=github.com/agentgateway/go/api/common \
./crates/agentgateway/proto/mcp/target.proto
protoc --proto_path=./crates/agentgateway/proto/ \
--go_out=./go/api \
--go_opt=paths=source_relative \
./crates/agentgateway/proto/listener.proto
PROTO_PATH=./crates/agentgateway/proto/
GO_OUT_BASE=./go/api
GO_OPTS=--go_opt=paths=source_relative --go_opt=Mcommon.proto=github.com/agentgateway/go/api/common
protoc --proto_path=$(PROTO_PATH) \
--go_out=$(GO_OUT_BASE)/a2a \
$(GO_OPTS) \
$(PROTO_PATH)/a2a/target.proto
protoc --proto_path=$(PROTO_PATH) \
--go_out=$(GO_OUT_BASE)/mcp \
$(GO_OPTS) \
$(PROTO_PATH)/mcp/target.proto
protoc --proto_path=$(PROTO_PATH) \
--go_out=$(GO_OUT_BASE) \
--go_opt=paths=source_relative \
$(PROTO_PATH)/listener.proto

Copilot uses AI. Check for mistakes.

@EItanya EItanya merged commit a692161 into agentgateway:main May 16, 2025
7 checks passed
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.

2 participants
0