-
Notifications
You must be signed in to change notification settings - Fork 97
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
Refs #38077 - Don't build hidden params as options #634
Refs #38077 - Don't build hidden params as options #634
Conversation
37b65af
to
3471fcc
Compare
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.
Can't comment on the code much but I tested it with theforeman/foreman#10322 and it works as intended.
# require 'pry-byebug'; binding.pry if associated_resource.to_s == "location" | ||
# parent_show_from_api = ParamsNameFilter.new("#{aliased_name}_id").for_action(@resource.action(@context[:action].to_s)).first&.show? |
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.
# require 'pry-byebug'; binding.pry if associated_resource.to_s == "location" | |
# parent_show_from_api = ParamsNameFilter.new("#{aliased_name}_id").for_action(@resource.action(@context[:action].to_s)).first&.show? |
options << family.parent( | ||
optionamize("--#{aliased_name}-id"), | ||
"#{aliased_name}_id".upcase, | ||
description("#{aliased_name}_id", @context[:action]), | ||
attribute_name: HammerCLI.option_accessor_name("#{resource_name}_id"), | ||
referenced_resource: resource_name, | ||
aliased_resource: aliased_name, | ||
format: HammerCLI::Options::Normalizers::Number.new | ||
format: HammerCLI::Options::Normalizers::Number.new, | ||
# show: parent_show_from_api ? parent_show_from_api : true |
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.
# show: parent_show_from_api ? parent_show_from_api : true |
3471fcc
to
1a88c77
Compare
1a88c77
to
a7ff2ad
Compare
Oops, some debug leftovers, updated. Thanks, @adamlazik1 ! Since the PRs in Foreman and apipie-bindings got merged, could you please re-test it in case I missed something? |
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.
Confirming that it works as intented.
Retested with hammer user-group external
:
Before:
$ hammer user-group external create -h
Usage:
hammer user-group external create [OPTIONS]
Options:
--auth-source[-id] VALUE/NUMBER Name/id of linked authentication source
--location[-id|-title] VALUE/NUMBER Set the current location context for the request
--name VALUE External user group name
--organization[-id|-title] VALUE/NUMBER Set the current organization context for the request
--user-group[-id] VALUE Name/id or name of user group
-h, --help Print help
After:
$ hammer user-group external create -h
Usage:
hammer user-group external create [OPTIONS]
Options:
--auth-source[-id] VALUE/NUMBER Name/id of linked authentication source
--name VALUE External user group name
--user-group[-id] VALUE Name/id or name of user group
-h, --help Print help
The repository in unit tests needs to be reverted before merging. Just putting it here so it is not forgotten.
a7ff2ad
to
e3563f9
Compare
Requires:
@adamlazik1, you might be interested in this, since it tries to use your changes in theforeman/foreman#10322.
Note: this PR includes test data from Foreman 3.14 API docs, generated using theforeman/foreman#10322.