refactor(frontier): remove grpc-gateway and openapiv2 annotations#444
refactor(frontier): remove grpc-gateway and openapiv2 annotations#444whoAbhishekSah wants to merge 1 commit 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>
📝 WalkthroughWalkthroughThis PR removes OpenAPI/Swagger metadata annotations and gRPC gateway HTTP bindings from protobuf definitions across the Frontier API schema, eliminating generated REST endpoint documentation and field-level descriptors while preserving core message and RPC declarations. 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)
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 keyword = 3 []; | ||
| string org_id = 4 []; | ||
| string group_id = 5 []; | ||
| string state = 6 []; |
There was a problem hiding this comment.
Empty field option brackets [] are invalid protobuf syntax — confirmed by static analysis.
When the openapiv2_field annotations were removed, many fields were left with empty option brackets [], which is not valid protobuf syntax. The static analysis tool confirms failures on these lines (syntax error: unexpected ']'). This pattern is repeated across many fields in this file.
Affected lines include: 243–246, 263–264, 272–273, 290–291, 295–296, 304–305, 313–315, 360–361, 365, 423–424, 441–442, 490–491, 723–724, 742–745, 776–777, 795–798, 1023.
Remove the empty [] entirely from these field declarations.
🐛 Example fix (apply the same pattern throughout)
- string keyword = 3 [];
- string org_id = 4 [];
- string group_id = 5 [];
- string state = 6 [];
+ string keyword = 3;
+ string org_id = 4;
+ string group_id = 5;
+ string state = 6;📝 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 keyword = 3 []; | |
| string org_id = 4 []; | |
| string group_id = 5 []; | |
| string state = 6 []; | |
| string keyword = 3; | |
| string org_id = 4; | |
| string group_id = 5; | |
| string state = 6; |
🧰 Tools
🪛 GitHub Check: validate
[failure] 246-246:
syntax error: unexpected ']'
[failure] 245-245:
syntax error: unexpected ']'
[failure] 244-244:
syntax error: unexpected ']'
[failure] 243-243:
syntax error: unexpected ']'
🤖 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 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).
| string id = 1 [ | ||
| (google.api.field_behavior) = REQUIRED, | ||
| (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "The webhook id to update."}, | ||
| (google.api.field_behavior) = REQUIRED | ||
| (validate.rules).string.uuid = true | ||
| ]; |
There was a problem hiding this comment.
Missing comma between field options — syntax error.
Multiple field option lists are missing the required comma separator between options. This likely happened when an intermediate annotation (e.g., an openapiv2_field option) was removed along with its trailing comma, leaving two options without a separator.
Affected locations:
- Lines 557–560 (
UpdateWebhookRequest.id) - Lines 569–572 (
DeleteWebhookRequest.id) - Lines 961–964 (
SearchUserOrganizationsRequest.id) - Lines 987–990 (
SearchUserProjectsRequest.user_id) - Lines 991–994 (
SearchUserProjectsRequest.org_id)
🐛 Proposed fix (showing one instance, apply similarly to all)
string id = 1 [
- (google.api.field_behavior) = REQUIRED
+ (google.api.field_behavior) = REQUIRED,
(validate.rules).string.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, | |
| (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "The webhook id to update."}, | |
| (google.api.field_behavior) = REQUIRED | |
| (validate.rules).string.uuid = true | |
| ]; | |
| string id = 1 [ | |
| (google.api.field_behavior) = REQUIRED, | |
| (validate.rules).string.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 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.
| 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).
| string title = 2 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "The title can contain any UTF-8 character, used to provide a human-readable name for the organization. Can also be left empty.<br/> *Example*: `\"Acme Inc\"`"}]; | ||
| google.protobuf.Struct metadata = 3 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Metadata object for organizations that can hold key value pairs defined in Organization Metaschema. The metadata object can be used to store arbitrary information about the organization such as labels, descriptions etc. The default Organization Metaschema contains labels and descripton fields. Update the Organization Metaschema to add more fields. <br/>*Example*:`{\"labels\": {\"key\": \"value\"}, \"description\": \"Organization description\"}`"}]; | ||
| string title = 2 []; | ||
| google.protobuf.Struct metadata = 3 [, \"description\": \"Organization description\"}`"}]; |
There was a problem hiding this comment.
Corrupted field annotation — incomplete removal of openapiv2 metadata.
Line 1024 has a malformed remnant from the annotation removal:
google.protobuf.Struct metadata = 3 [, \"description\": \"Organization description\"}`"}];
This is not valid protobuf syntax and will fail compilation. The annotation content was only partially removed.
🐛 Proposed fix
- google.protobuf.Struct metadata = 3 [, \"description\": \"Organization description\"}`"}];
+ google.protobuf.Struct metadata = 3;📝 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.
| google.protobuf.Struct metadata = 3 [, \"description\": \"Organization description\"}`"}]; | |
| google.protobuf.Struct metadata = 3; |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@raystack/frontier/v1beta1/admin.proto` at 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.
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