refactor(frontier): remove grpc-gateway and openapiv2 annotations#444
refactor(frontier): remove grpc-gateway and openapiv2 annotations#444whoAbhishekSah wants to merge 2 commits intomainfrom
Conversation
Frontier no longer uses grpc-gateway. Remove all gateway-related annotations from proto files: - Remove `protoc-gen-openapiv2` import, swagger, operation, and field annotations - Remove `google.api.http` annotations and imports - Keep `google.api.field_behavior` and `validate` annotations Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR removes OpenAPI/Swagger annotations and gRPC gateway HTTP bindings from protobufs, stripping field-level openapiv2 and grpc-gateway metadata while preserving all message types and RPC signatures. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@raystack/frontier/v1beta1/admin.proto`:
- Around line 243-246: The proto contains invalid empty field option brackets
"[]" on multiple field declarations (e.g., fields named keyword, org_id,
group_id, state and many others) which causes a syntax error; remove the empty
brackets entirely from each affected field declaration (search for occurrences
of " = <number> [];" and change them to " = <number> ;") across the file so
declarations like string keyword = 3 []; string org_id = 4 []; etc. become valid
protobuf fields, and repeat this fix for all listed occurrences (including the
other affected fields referenced in the review).
- Around line 557-560: Each of the proto field option lists is missing the comma
separator between multiple options; for each affected field (e.g.,
UpdateWebhookRequest.id, DeleteWebhookRequest.id,
SearchUserOrganizationsRequest.id, SearchUserProjectsRequest.user_id,
SearchUserProjectsRequest.org_id) update the field option bracket to include a
comma between options (for example: (google.api.field_behavior) = REQUIRED,
(validate.rules).string.uuid = true) so the options are valid protobuf syntax;
apply this same fix to all listed fields.
- Line 1024: The field declaration for metadata in admin.proto is corrupted by
leftover openapiv2 annotation remnants; update the declaration for the field
named "metadata" (google.protobuf.Struct metadata) to valid protobuf syntax by
removing the entire malformed annotation suffix and terminating the field
properly (e.g., "google.protobuf.Struct metadata = 3;"), ensuring no stray
characters or annotation fragments remain.
- Around line 693-698: The field definition for id contains an accidental double
semicolon and split validate rules; remove the extra semicolon after the options
and consolidate the two validate.rules entries into a single
(validate.rules).string block that includes both min_len and uuid to avoid
conflicting/duplicated options (target the field named "id" and its
(google.api.field_behavior) / (validate.rules).string annotations).
- Around line 5-9: admin.proto still references google.api.HttpBody for six RPCs
(the methods around lines 60, 65, 70, 75, 80 and 226) but the httpbody import
was removed, so protobuf compilation fails; instead of re-adding
google/api/httpbody.proto, define explicit response message types in
raystack/frontier/v1beta1/models.proto (e.g., StreamingResponse, ExportResponse,
etc.) that capture the streamed payload or metadata you need, update each RPC in
admin.proto to return those specific messages (or a google.protobuf.Any/bytes
field inside those messages if the payload is opaque), and then remove the
now-unused google.api.httpbody import from admin.proto; target the RPC
signatures around the noted lines and corresponding response message definitions
in models.proto when making the change.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
raystack/frontier/v1beta1/admin.protoraystack/frontier/v1beta1/frontier.protoraystack/frontier/v1beta1/models.proto
| import "google/api/field_behavior.proto"; | ||
| import "google/protobuf/struct.proto"; | ||
| import "google/protobuf/timestamp.proto"; | ||
| import "google/api/httpbody.proto"; | ||
| import "protoc-gen-openapiv2/options/annotations.proto"; | ||
| import "raystack/frontier/v1beta1/models.proto"; | ||
| import "validate/validate.proto"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify import status and HttpBody usages in admin.proto
echo "=== Checking for httpbody imports ==="
rg -n 'import.*httpbody' raystack/frontier/v1beta1/admin.proto || echo "(no httpbody imports found)"
echo ""
echo "=== Checking for HttpBody type usages ==="
rg -n 'HttpBody' raystack/frontier/v1beta1/admin.proto || echo "(no HttpBody usages found)"
echo ""
echo "=== Showing all imports in the file ==="
head -20 raystack/frontier/v1beta1/admin.protoRepository: raystack/proton
Length of output: 1456
Missing import for google.api.HttpBody — protobuf compilation will fail.
The import for google/api/httpbody.proto has been removed, but six RPCs still reference google.api.HttpBody as their return type (lines 60, 65, 70, 75, 80, 226). This causes an undefined type error during compilation.
Since the raystack/proton project no longer uses gRPC-Gateway, these streaming RPCs should be refactored to use a different return type instead of restoring the import.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@raystack/frontier/v1beta1/admin.proto` around lines 5 - 9, admin.proto still
references google.api.HttpBody for six RPCs (the methods around lines 60, 65,
70, 75, 80 and 226) but the httpbody import was removed, so protobuf compilation
fails; instead of re-adding google/api/httpbody.proto, define explicit response
message types in raystack/frontier/v1beta1/models.proto (e.g.,
StreamingResponse, ExportResponse, etc.) that capture the streamed payload or
metadata you need, update each RPC in admin.proto to return those specific
messages (or a google.protobuf.Any/bytes field inside those messages if the
payload is opaque), and then remove the now-unused google.api.httpbody import
from admin.proto; target the RPC signatures around the noted lines and
corresponding response message definitions in models.proto when making the
change.
| string id = 1 [ | ||
| (google.api.field_behavior) = REQUIRED, | ||
| (validate.rules).string = {min_len: 1}, | ||
| (validate.rules).string.uuid = true, | ||
| (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "id of the prospect"} | ||
| (validate.rules).string.uuid = true | ||
| ];; | ||
| } |
There was a problem hiding this comment.
Double semicolon and potentially conflicting validate rules.
Line 697 has a double semicolon (];;). While proto3 may tolerate an extra empty statement, this is likely unintentional from the annotation removal and should be cleaned up.
Additionally, Lines 694–696 define two separate (validate.rules).string entries — one as a message literal {min_len: 1} and one as a scalar uuid = true. Depending on how protoc-gen-validate merges these, they could conflict. Consider consolidating:
🧹 Proposed fix
string id = 1 [
(google.api.field_behavior) = REQUIRED,
- (validate.rules).string = {min_len: 1},
- (validate.rules).string.uuid = true
- ];;
+ (validate.rules).string = {min_len: 1, uuid: true}
+ ];📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| string id = 1 [ | |
| (google.api.field_behavior) = REQUIRED, | |
| (validate.rules).string = {min_len: 1}, | |
| (validate.rules).string.uuid = true, | |
| (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "id of the prospect"} | |
| (validate.rules).string.uuid = true | |
| ];; | |
| } | |
| string id = 1 [ | |
| (google.api.field_behavior) = REQUIRED, | |
| (validate.rules).string = {min_len: 1, uuid: true} | |
| ]; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@raystack/frontier/v1beta1/admin.proto` around lines 693 - 698, The field
definition for id contains an accidental double semicolon and split validate
rules; remove the extra semicolon after the options and consolidate the two
validate.rules entries into a single (validate.rules).string block that includes
both min_len and uuid to avoid conflicting/duplicated options (target the field
named "id" and its (google.api.field_behavior) / (validate.rules).string
annotations).
The annotation removal script left behind: - Empty field option brackets `[]` on fields - Missing commas between remaining field options - Partial annotation remnants on metadata fields - Incorrectly removed google/api/httpbody.proto import (still needed for HttpBody return types) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
protoc-gen-openapiv2import,openapiv2_swagger,openapiv2_operation,openapiv2_fieldannotationsgoogle.api.httpannotations andgoogle/api/annotations.proto/google/api/httpbody.protoimportsgoogle.api.field_behaviorandvalidateannotations (still used)Test plan
buf buildsucceedsbuf generateproduces valid ConnectRPC stubs🤖 Generated with Claude Code
Summary by CodeRabbit