-
Notifications
You must be signed in to change notification settings - Fork 37.7k
rpc: Replace OMITTED_NAMED_ARG with OMITTED #19262
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
Conversation
fa6601e
to
fab2f3b
Compare
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
This change doesn't seem correct if they're optional ("can be omitted"")? |
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.
Code review ACK fab2f3b. Suggested more changes, but this is fine and seems to be moving in a good direction.
} | ||
if (m_fallback.which() == 1) { | ||
ret += ", optional, default=" + boost::get<std::string>(m_fallback); | ||
} else { | ||
switch (boost::get<RPCArg::Optional>(m_fallback)) { | ||
case RPCArg::Optional::OMITTED: { | ||
if (is_top_level_arg) { |
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.
In commit "refactor: Replace confusing OMITTED_NAMED_ARG with OMITTED" (fab2f3b)
Along lines of laanwj's comment #19262 (comment), it doesn't seem like is_top_level_arg
is the right condition to be checking here. It seems helpful to add ", optional" for any field value, not just a top level argument value. Maybe is_top_level_arg
should be is_array_element
, since it does make sense to hide ", optional" inside a list where presumably every element is optional.
|
||
// no default case, so the compiler can warn about missing cases | ||
} | ||
} // no default case, so the compiler can warn about missing cases | ||
} | ||
if (m_fallback.which() == 1) { | ||
ret += ", optional, default=" + boost::get<std::string>(m_fallback); | ||
} else { | ||
switch (boost::get<RPCArg::Optional>(m_fallback)) { | ||
case RPCArg::Optional::OMITTED: { |
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.
In commit "refactor: Replace confusing OMITTED_NAMED_ARG with OMITTED" (fab2f3b)
For a future followup I think it'd be good to consider renaming Optional::OMITTED
to Optional::YES
to match the Optional::NO
. It doesn't seem clear in context what "OMITTED" actually omits.
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.
It doesn't seem clear in context what "OMITTED" actually omits.
It means the default value is omitted. So RPCArg::Optional::OMITTED*
could become RPCArg::DefaultOmitted
? (Compare to Default
and DefaultHint
)
fab2f3b
to
c7753f5
Compare
🐙 This pull request conflicts with the target branch and needs rebase. |
Concept NACK. Seems like a pointless refactor that just conflates two different meanings behind the same flag. Does it accomplish something? |
No it does not. Thanks for the NACK and closing for now. |
Well, there are some bugfixes here, but I'll submit them separately. |
Removed the refactor in #26706 |
This simplifies how omitted args are passed into the rpc help manager.
Previously, omitted named args had to be passed in as
OMITTED_NAMED_ARG
. However, the rpc help manager already knows when an arg is a top level argument. Thus,OMITTED_NAMED_ARG
can simply be replaced byOMITTED
.Some calls have been using the omitted-enum incorrectly, thus the rendered diff (effect of the changes here) is: