Skip to content

Comments

refactor(frontier): remove grpc-gateway and openapiv2 annotations#444

Open
whoAbhishekSah wants to merge 1 commit intomainfrom
refactor/remove-frontier-gateway-annotations
Open

refactor(frontier): remove grpc-gateway and openapiv2 annotations#444
whoAbhishekSah wants to merge 1 commit intomainfrom
refactor/remove-frontier-gateway-annotations

Conversation

@whoAbhishekSah
Copy link
Member

@whoAbhishekSah whoAbhishekSah commented Feb 24, 2026

Summary

  • Frontier no longer uses grpc-gateway (removed in refactor(server): remove gRPC and gRPC-gateway server implementation frontier#1404)
  • Remove all gateway-related annotations from frontier proto files (-2,469 lines):
    • protoc-gen-openapiv2 import, openapiv2_swagger, openapiv2_operation, openapiv2_field annotations
    • google.api.http annotations and google/api/annotations.proto / google/api/httpbody.proto imports
  • Keep google.api.field_behavior and validate annotations (still used)

Test plan

  • buf build succeeds
  • Frontier buf generate produces valid ConnectRPC stubs

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactoring
    • Removed OpenAPI and gRPC Gateway metadata annotations from API service and message field definitions.
    • Simplified REST endpoint documentation bindings and descriptive field metadata across multiple message types.

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>
@coderabbitai
Copy link

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
OpenAPI/HTTP Metadata Removal
raystack/frontier/v1beta1/admin.proto
Removed global openapiv2_swagger configuration block, openapiv2_operation annotations from all AdminService RPCs, google.api/http bindings, and field-level OpenAPI descriptions. Retained all RPC signatures and message declarations without functional changes.
Field Annotation Cleanup
raystack/frontier/v1beta1/models.proto
Removed openapiv2_field and field_behavior (OUTPUT_ONLY, REQUIRED) annotations from numerous message fields across Invitation, MetaSchema, AuditLog, WebhookEvent, Resource, Domain, Policy, Relation, Permission, Namespace and other messages. Preserved field types, names, and numerical tags.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Annotations stripped away with glee,
No REST paths, no OpenAPI swee,
Clean protos now, so lean and bright,
Core schemas shine in starry light!
Metadata gone—simplicity's delight!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing grpc-gateway and openapiv2 annotations from Frontier proto files, which is the primary purpose of the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/remove-frontier-gateway-annotations

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 330c755 and 83275e9.

📒 Files selected for processing (3)
  • raystack/frontier/v1beta1/admin.proto
  • raystack/frontier/v1beta1/frontier.proto
  • raystack/frontier/v1beta1/models.proto

Comment on lines 5 to 9
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";
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 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.proto

Repository: 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.

Comment on lines +243 to +246
string keyword = 3 [];
string org_id = 4 [];
string group_id = 5 [];
string state = 6 [];
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
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).

Comment on lines 557 to 560
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
];
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
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.

Comment on lines 693 to 698
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
];;
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

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.

Suggested 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
];;
}
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\"}`"}];
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
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.

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