« Back to Search  |  Reader Mode  |  Switch to Full Retro Site View Links: Stay in Reader  |  Retro Mode: ON  |  Original »
GitHub · Extracted in 911 ms

fix: iids not working as a list in projects.issues.list() by JohnVillalovos · Pull Request #1413 · python-gitlab/python-gitlab

Source: https://github.com/python-gitlab/python-gitlab/pull/1413

Repository navigation

fix: iids not working as a list in projects.issues.list() - #1413


Merged
nejch merged 1 commit into python-gitlab:master from JohnVillalovos:jlvillal/1407 Apr 27, 2021
Merged

fix: iids not working as a list in projects.issues.list() #1413 nejch merged 1 commit into python-gitlab:master from JohnVillalovos:jlvillal/1407

Conversation

JohnVillalovos commented Apr 25, 2021 · edited Loading



Copy link Copy Markdown
Member

Set the 'iids' values as type ListAttribute so it will pass the list
as a comma-separated string, instead of a list.

Closes : #1407

codecov-commenter commented Apr 25, 2021 · edited Loading



Copy link Copy Markdown

Codecov Report

Merging #1413 (265bc13 ) into master (dde01c7 ) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1413   +/-   ##
=======================================
  Coverage   80.24%   80.24%           
=======================================
  Files          73       73           
  Lines        4064     4064           
=======================================
  Hits         3261     3261           
  Misses        803      803           
Flag Coverage Δ
unit 80.24% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gitlab/v4/objects/issues.py 80.88% <100.00%> (ø)

Continue to review full report at Codecov .

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov . Last update dde01c7...265bc13 . Read the comment docs .

JohnVillalovos mentioned this pull request Apr 25, 2021 Trying to Fetch multiple ProjectIssues in a single batch call returns only the last ProjectIssue specified in the list #1407 Closed JohnVillalovos marked this pull request as draft April 25, 2021 00:23

JohnVillalovos commented Apr 25, 2021



Copy link Copy Markdown
Member

Author

This doesn't work at the moment. ListAttribute assumes the input is a string.

JohnVillalovos marked this pull request as ready for review April 25, 2021 22:48

JohnVillalovos commented Apr 25, 2021 · edited Loading



Copy link Copy Markdown
Member

Author

This depends on #1415 getting merged or this whole patch chain could be merged and #1415 could be closed.

JohnVillalovos commented Apr 25, 2021 · edited Loading



Copy link Copy Markdown
Member

Author

I tested this and reproduced the issue and then with my change it worked correctly.

Likely I should probably update this patch to cover all the other instances of iids

I think all of these API endpoints would need to be updated. This is searching the GitLab source code for users of CommaSeparatedToIntegerArray.

~/source/gitlab/ $ rg --sort path 'coerce_with.*CommaSeparatedToIntegerArray'
doc/development/api_styleguide.md
120:optional :user_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The user ids for this rule'

ee/lib/api/geo_nodes.rb
51:        optional :selective_sync_namespace_ids, as: :namespace_ids, type: Array[Integer], coerce_with: Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The IDs of groups that should be synced, if `selective_sync_type` == `namespaces`'
208:          optional :selective_sync_namespace_ids, as: :namespace_ids, type: Array[Integer], coerce_with: Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The IDs of groups that should be synced, if `selective_sync_type` == `namespaces`'

ee/lib/api/helpers/project_approval_rules_helpers.rb
12:        optional :users, as: :user_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The user ids for this rule'
13:        optional :groups, as: :group_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The group ids for this rule'
14:        optional :protected_branch_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The protected branch ids for this rule'
21:        optional :users, as: :user_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The user ids for this rule'
22:        optional :groups, as: :group_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The group ids for this rule'
23:        optional :protected_branch_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The protected branch ids for this rule'

ee/lib/api/merge_request_approval_rules.rb
35:          optional :user_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The user ids for this rule'
36:          optional :group_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The group ids for this rule'
57:            optional :user_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The user ids for this rule'
58:            optional :group_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The group ids for this rule'

ee/lib/api/project_approvals.rb
65:        requires :approver_ids, type: Array[Integer], coerce_with: Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Array of User IDs to set as approvers.'
66:        requires :approver_group_ids, type: Array[Integer], coerce_with: Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Array of Group IDs to set as approvers.'

ee/lib/ee/api/helpers/settings_helpers.rb
29:              optional :elasticsearch_namespace_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The namespace ids to index with Elasticsearch.'
30:              optional :elasticsearch_project_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The project ids to index with Elasticsearch.'

ee/lib/ee/api/merge_request_approvals.rb
87:              requires :approver_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce,
89:              requires :approver_group_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce,

lib/api/groups.rb
21:        optional :skip_groups, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Array of group ids to exclude from list'

lib/api/issues.rb
17:        optional :iids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The IID array of issues'
69:        optional :assignee_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The array of user IDs to assign issue'

lib/api/members.rb
23:          optional :user_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Array of user ids to look up for membership'
42:          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/merge_requests.rb
162:          optional :assignee_ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The array of user IDs to assign issue'
182:        optional :iids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The IID array of merge requests'

lib/api/milestone_responses.rb
18:          optional :iids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'The IIDs of the milestones'

lib/api/projects.rb
549:        optional :skip_users, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: 'Filter out users with the specified IDs'

lib/api/suggestions.rb
28:        requires :ids, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce, desc: "An array of suggestion ID's"

spec/lib/api/helpers/common_helpers_spec.rb
20:        optional :array_of_ints, type: Array[Integer], coerce_with: ::API::Validations::Types::CommaSeparatedToIntegerArray.coerce

JohnVillalovos commented Apr 27, 2021 · edited Loading



Copy link Copy Markdown
Member

Author

@nejch I added a functional test that shows this works. I tried the functional test first without the fix and it failed.

Failed functional test without fix: https://github.com/python-gitlab/python-gitlab/runs/2449139416?check_suite_focus=true

fix: iids not working as a list in projects.issues.list() 45f806c
Set the 'iids' values as type ListAttribute so it will pass the list
as a comma-separated string, instead of a list.

Add a functional test.

Closes: #1407

nejch commented Apr 27, 2021



Copy link Copy Markdown
Member

@nejch I added a functional test that shows this works. I tried the functional test first without the fix and it failed.

Failed functional test without fix: https://github.com/python-gitlab/python-gitlab/runs/2449139416?check_suite_focus=true

Awesome! i just trust functional tests so much more because they catch these real issues and behavior. Thanks :)

nejch approved these changes Apr 27, 2021
View reviewed changes
nejch enabled auto-merge April 27, 2021 15:24 nejch merged commit a6b6cd4 into python-gitlab : master Apr 27, 2021 JohnVillalovos deleted the jlvillal/1407 branch April 27, 2021 16:03 nejch mentioned this pull request Apr 27, 2021 fix(objects): make lists work for filters in all objects #1420 Merged Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

None yet

3 participants