Skip to content
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

Missing parameters in iteration search #2795

Closed
cristianocasella opened this issue Feb 12, 2024 · 3 comments
Closed

Missing parameters in iteration search #2795

cristianocasella opened this issue Feb 12, 2024 · 3 comments

Comments

@cristianocasella
Copy link
Contributor

cristianocasella commented Feb 12, 2024

Description of the problem, including code/CLI snippet

In https://github.com/python-gitlab/python-gitlab/blob/main/gitlab/v4/objects/iterations.py the iteration implementation let you to filter the list with a search parameter.

According to the API doc (https://docs.gitlab.com/ee/api/iterations.html) by default this parameter filter the title of the iteration.

If the iteration is created by a cadence, title and description will be empty, so you will not be able to search for a specific iteration.

Expected Behavior

I would like to pass the additional parameter, documented in the API, "in" to select where the search will be performed, and search in "cadence_title" for cadence derivated iterations.

Actual Behavior

The search is only performed on the iteration title, that is empty when built from a cadence.

Specifications

  • python-gitlab version: 4.4.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 16.8.1 EE

Update

After a first iteration we decided to extend the scope to all the new parameters available

@nejch
Copy link
Member

nejch commented Feb 12, 2024

Thanks for the report and the PR @cristianocasella!

Note that the list filter attribute is only used for the CLI. You can pass arbitrary arguments to the list methods when using the API already.

The problem with the in keyword is that it collides with python's in keyword so you'll always get a SyntaxError. For this reason, we have to use the query_parameters argument:

group.iterations.list(query_parameters={"in": "title"}) 

See https://python-gitlab.readthedocs.io/en/stable/api-usage.html#managers for more details.

@cristianocasella
Copy link
Contributor Author

Thanks for the report and the PR @cristianocasella!

Note that the list filter attribute is only used for the CLI. You can pass arbitrary arguments to the list methods when using the API already.

The problem with the in keyword is that it collides with python's in keyword so you'll always get a SyntaxError. For this reason, we have to use the query_parameters argument:

group.iterations.list(query_parameters={"in": "title"}) 

See https://python-gitlab.readthedocs.io/en/stable/api-usage.html#managers for more details.

Really thanks for your support and hint.

I decided to extend the PR to all the parameters currently available, to save other people time I also added your help above into the project documentation.

Let me know if it works for you

@cristianocasella cristianocasella changed the title Missing "in" field in iteration search Missing parameters in iteration search Feb 12, 2024
@nejch
Copy link
Member

nejch commented May 22, 2024

Done in #2796.

@nejch nejch closed this as completed May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants