-
Notifications
You must be signed in to change notification settings - Fork 259
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
fix(grpc): schema validation for fields in snake_case #1527
Conversation
WalkthroughThe recent modifications enhance visibility and naming conventions across several components, with a focus on gRPC and JSON handling. The changes make certain functions public for broader testing, improve field naming consistency in protobuf definitions, and incorporate a case conversion utility to ensure JSON schema field names adhere to camelCase standards. Additionally, there's an emphasis on facilitating protobuf to JSON conversion testing, indicating a stride towards more flexible and interoperable data handling. Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1527 +/- ##
==========================================
+ Coverage 88.34% 88.36% +0.01%
==========================================
Files 135 135
Lines 14611 14631 +20
==========================================
+ Hits 12908 12928 +20
Misses 1703 1703 ☔ View full report in Codecov by Sentry. |
updated the examples tailcallhq/rust-grpc#15 and tailcallhq/node-grpc#5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files ignored due to path filters (2)
Cargo.lock
is excluded by:!**/*.lock
Cargo.toml
is excluded by:!**/*.toml
Files selected for processing (4)
- src/grpc/protobuf.rs (2 hunks)
- src/grpc/tests/proto/news.proto (1 hunks)
- src/grpc/tests/proto/news_no_pkg.proto (1 hunks)
- src/json/json_schema.rs (4 hunks)
Files skipped from review due to trivial changes (1)
- src/grpc/tests/proto/news.proto
Additional comments: 5
src/grpc/tests/proto/news_no_pkg.proto (1)
- 9-9: The field renaming from
postImage
topost_image
correctly follows the gRPC style guide's recommendation for using snake_case in protobuf message fields. Good job adhering to the conventions.src/json/json_schema.rs (2)
- 3-3: The addition of the
convert_case
crate is a suitable choice for converting field names from snake_case to camelCase, aligning with the PR objectives and theprost
library's behavior.- 162-165: Correctly implementing the conversion of field names from snake_case to camelCase using the
convert_case
crate ensures that the schema validation logic aligns with the automatic conversion behavior of theprost
library. This is a crucial update for consistency.src/grpc/protobuf.rs (2)
- 235-235: Making the
get_proto_file
function public enhances the testability of the codebase by allowing external access for testing purposes. This is a positive change in line with the PR objectives.- 204-204: Making the
tests
module public is a good practice for facilitating external testing, further improving the testability and maintainability of the codebase.
Summary:
Following by grpc style guide fields should be named in snake_case. prost also automatically converts snake_case naming to camelCase and other way around on serde serialization/deserialization for protobuf message. But the schema validation in tailcall was only checking raw name fields without considering that conversion happening.
This pr changes proto naming style to follow grpc guide and updates schema validation to execute the comparison between camelCase field names
Build & Testing:
cargo test
successfully../lint.sh --mode=fix
to fix all linting issues raised by./lint.sh --mode=check
.Checklist:
<type>(<optional scope>): <title>
Summary by CodeRabbit