fix(objects): make lists work for filters in all objects by nejch · Pull Request #1420 · python-gitlab/python-gitlab
Repository navigation
fix(objects): make lists work for filters in all objects - #1420
Merged
JohnVillalovos merged 2 commits into master from fix/missing-list-attributes May 6, 2021
Merged
fix(objects): make lists work for filters in all objects #1420 JohnVillalovos merged 2 commits into master from fix/missing-list-attributes
Conversation
nejch commented Apr 27, 2021 · edited Loading
Copy link Copy Markdown
Member
Well, this was tedious 😁 Follow-up to #1413 .
Long term I don't see this being a good idea to maintain manually. Maybe later we can just convert any list we get in the data for ListMixin. Either way - finding candidates was grep -r 'type: Array' lib/api in the gitlab repo, and weeding out non-GET params and endpoints not implemented by python-gitlab:
lib/api/resource_access_tokens.rb: requires :scopes, type: Array[String], desc: "The permissions of the token" lib/api/deploy_tokens.rb: requires :scopes, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, values: ::DeployToken::AVAILABLE_SCOPES.map(&:to_s), lib/api/deploy_tokens.rb: requires :scopes, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, values: ::DeployToken::AVAILABLE_SCOPES.map(&:to_s), lib/api/rubygem_packages.rb: optional :gems, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma delimited gem names' lib/api/releases.rb: optional :links, type: Array do lib/api/releases.rb: optional :milestones, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'The titles of the related milestones', default: [] lib/api/releases.rb: optional :milestones, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'The titles of the related milestones' lib/api/settings.rb: optional :asset_proxy_whitelist, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Deprecated: Use :asset_proxy_allowlist instead. Assets that match these domain(s) will NOT be proxied. Wildcards allowed. Your GitLab installation URL is automatically whitelisted.' lib/api/settings.rb: optional :asset_proxy_allowlist, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Assets that match these domain(s) will NOT be proxied. Wildcards allowed. Your GitLab installation URL is automatically allowed.' lib/api/settings.rb: optional :disabled_oauth_sign_in_sources, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Disable certain OAuth sign-in sources' lib/api/settings.rb: optional :domain_denylist, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Users with e-mail addresses that match these domain(s) will NOT be able to sign-up. Wildcards allowed. Use separate lines for multiple entries. Ex: domain.com, *.domain.com' lib/api/settings.rb: optional :domain_allowlist, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'ONLY users with e-mail addresses that match these domain(s) will be able to sign-up. Wildcards allowed. Use separate lines for multiple entries. Ex: domain.com, *.domain.com' lib/api/settings.rb: optional :import_sources, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, lib/api/settings.rb: optional :restricted_visibility_levels, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Selected levels cannot be used by non-admin users for groups, projects or snippets. If the public level is restricted, user profiles are only visible to logged in users.' lib/api/repositories.rb: requires :refs, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce lib/api/milestone_responses.rb: optional :iids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The IIDs of the milestones' lib/api/container_registry_event.rb: requires :events, type: Array lib/api/commits.rb: requires :actions, type: Array, desc: 'Actions to perform in commit' do lib/api/helpers/merge_requests_helpers.rb: optional :assignee_username, type: Array[String], check_assignees_count: true, lib/api/helpers/merge_requests_helpers.rb: type: Array[String], lib/api/helpers/projects_helpers.rb: optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'The list of tags for a project' lib/api/helpers/snippets_helpers.rb: optional :files, type: Array, desc: 'An array of files' do lib/api/helpers/snippets_helpers.rb: optional :files, type: Array, desc: 'An array of files to update' do lib/api/members.rb: optional :user_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Array of user ids to look up for membership' lib/api/members.rb: optional :user_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Array of user ids to look up for membership' lib/api/projects.rb: optional :topic, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of topics. Limit results to projects having all topics' lib/api/projects.rb: optional :skip_users, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Filter out users with the specified IDs' lib/api/projects.rb: optional :skip_groups, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Array of group ids to exclude from list' lib/api/suggestions.rb: requires :ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: "An array of suggestion ID's" lib/api/ci/runner.rb: optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: %q(List of Runner's tags) lib/api/ci/runners.rb: optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'The tags of the runners to show' lib/api/ci/runners.rb: optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'The tags of the runners to show' lib/api/ci/runners.rb: optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'The list of tags for a runner' lib/api/ci/runners.rb: optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'The tags of the runners to show' lib/api/ci/runners.rb: optional :tag_list, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'The tags of the runners to show' lib/api/issues.rb: optional :labels, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names' lib/api/issues.rb: optional :iids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The IID array of issues' lib/api/issues.rb: optional :assignee_username, type: Array[String], check_assignees_count: true, lib/api/issues.rb: optional :labels, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names' lib/api/issues.rb: optional :iids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The IID array of issues' lib/api/issues.rb: optional :assignee_username, type: Array[String], check_assignees_count: true, lib/api/issues.rb: optional :assignee_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The array of user IDs to assign issue' lib/api/issues.rb: optional :labels, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names' lib/api/issues.rb: optional :add_labels, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names' lib/api/issues.rb: optional :remove_labels, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names' lib/api/groups.rb: optional :skip_groups, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Array of group ids to exclude from list' lib/api/users.rb: optional :scopes, type: Array, desc: 'The array of scopes of the impersonation token' lib/api/users.rb: requires :scopes, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, values: ::Gitlab::Auth.all_available_scopes.map(&:to_s), lib/api/feature_flags.rb: optional :scopes, type: Array do lib/api/feature_flags.rb: optional :strategies, type: Array do lib/api/feature_flags.rb: optional :scopes, type: Array do lib/api/feature_flags.rb: optional :strategies, type: Array do lib/api/feature_flags.rb: optional :scopes, type: Array do lib/api/merge_requests.rb: optional :assignee_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Comma-separated list of assignee ids' lib/api/merge_requests.rb: optional :reviewer_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Comma-separated list of reviewer ids' lib/api/merge_requests.rb: optional :labels, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names' lib/api/merge_requests.rb: optional :add_labels, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names' lib/api/merge_requests.rb: optional :remove_labels, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names' lib/api/merge_requests.rb: optional :iids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The IID array of merge requests' lib/api/merge_requests.rb: requires :commits, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, allow_blank: false, desc: 'List of context commits sha' lib/api/merge_requests.rb: requires :commits, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, allow_blank: false, desc: 'List of context commits sha'
fix(objects): allow lists for filters for in all objects
603a351
nejch
force-pushed
the
fix/missing-list-attributes
branch
from
1181e53 to
603a351
Compare
April 27, 2021 18:25
codecov-commenter commented Apr 27, 2021
Copy link Copy Markdown
Codecov Report
@@ Coverage Diff @@ ## master #1420 +/- ## ========================================== + Coverage 80.24% 80.53% +0.29% ========================================== Files 73 73 Lines 4064 4080 +16 ========================================== + Hits 3261 3286 +25 + Misses 803 794 -9
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov .
|
View reviewed changes
JohnVillalovos left a comment
Copy link Copy Markdown
Member
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
Looks good.
For the future it would be nice to have functional tests for some of these, but that is a MUCH bigger task.
Thanks!
JohnVillalovos commented Apr 28, 2021
Copy link Copy Markdown
Member
That sounds like a good idea. I think it should be possible to do that. If we have a |
nejch commented Apr 28, 2021
Copy link Copy Markdown
Member
Author
Yes agreed :) I'll try to add more fixtures so that writing functional tests is a bit quicker for these things. |
JohnVillalovos commented May 1, 2021
Copy link Copy Markdown
Member
|
@nejch I'm okay with merging this. Not sure if you also want @max-wittig to approve too. But I have no complaints if you want to merge it 🙂 |
test(functional): add test for skip_groups list filter
a014774
nejch commented May 6, 2021
Copy link Copy Markdown
Member
Author
|
Sure, assigning to you as you were pretty involved in the initial issue anyway :) I just pushed a small assert though that should prove we fixed at least the linked issue. The |
JohnVillalovos commented May 6, 2021
Copy link Copy Markdown
Member
|
Still looks good to me. An additional test is a nice addition. |
45edae9
into
master
May 6, 2021
nejch
mentioned this pull request
May 15, 2021
fix: make scopes work with multiple scope-names
#1360
Closed
nejch
deleted the
fix/missing-list-attributes
branch
May 30, 2021 08:18
Sign up for free
to join this conversation on GitHub .
Already have an account?
Sign in to comment