-
Notifications
You must be signed in to change notification settings - Fork 258
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): remove package from type names #1747
Conversation
WalkthroughWalkthroughThe recent update involves enhancing the Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
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 (
|
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.
Actionable comments posted: 1
src/generator/from_proto.rs
Outdated
let type_name = GraphQLType::new(enum_name) | ||
.package(&self.package) | ||
.as_enum() | ||
.unwrap() | ||
.to_string(); |
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.
Consider handling the potential None
case in the chain of method calls for type_name
instead of using unwrap()
, which could lead to runtime panics if the conversion fails.
- .unwrap()
+ .ok_or_else(|| "Failed to convert to enum".to_string())?
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.
let type_name = GraphQLType::new(enum_name) | |
.package(&self.package) | |
.as_enum() | |
.unwrap() | |
.to_string(); | |
let type_name = GraphQLType::new(enum_name) | |
.package(&self.package) | |
.as_enum() | |
.ok_or_else(|| "Failed to convert to enum".to_string())? | |
.to_string(); |
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.
actually, the GraphQLType<Unparsed>::parse
that is used by as_enum
could be rewritten without return Option that could simplify usage of it and remove unwraps
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.
@meskill, your suggestion to rewrite the GraphQLType<Unparsed>::parse
method used by as_enum
to not return an Option is intriguing. Removing the Option could indeed simplify the usage by eliminating the need for unwraps. However, this change would require a careful review of all places where this method is used to ensure that there are no cases where a None
return is expected or required.
Would you like to proceed with exploring this change in the current PR, or would you prefer to handle this as a separate task? If it's the latter, I can help by opening a GitHub issue to track this enhancement. Please let me know how you'd like to proceed!
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1747 +/- ##
==========================================
+ Coverage 86.93% 87.19% +0.25%
==========================================
Files 155 155
Lines 15540 15841 +301
==========================================
+ Hits 13510 13812 +302
+ Misses 2030 2029 -1 ☔ View full report in Codecov by Sentry. |
src/generator/snapshots/tailcall__generator__from_proto__test__from_proto.snap
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 1
enum NEWS_STATUS @tag(id: "news.Status") { | ||
DRAFT | ||
PUBLISHED | ||
} |
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.
Add tests for messages inside of messages.
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.
news.proto already contains message inside of message https://github.com/tailcallhq/tailcall/pull/1747/files#diff-771adfaaae91c7816aaf69af02c57749bfaaaa74e3db399e055104a8a1a6de23R26-R33
is it enough?
I'm not sure the name of the PR properly reflects the changes. |
Action required: PR inactive for 2 days. |
PR closed after 5 days of inactivity. |
Pull request was closed
Action required: PR inactive for 2 days. |
PR closed after 5 days of inactivity. |
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