You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The API allows for specifying fewer than 50 results, so should the SDK. For example, I want to even be able to set 0 if I just want to get the count for the query result, which currently, I cannot.
Is there an existing issue for this?
I have searched the existing issues
Jira Instance type
Jira Cloud (Hosted by Atlassian)
Jira instance version
cloud
jira-python version
3.6.0
Python Interpreter version
3.10.6
Which operating systems have you used?
Linux
macOS
Windows
Reproduction steps
# 1. Use `client.search(maxResults=0)`# 2. Observe the request URL in logs, the maxResults param has been changed to 100# 3. Execute the same request in Postman and observe the server responds with an empty array but with counts.Examplecodeunplanned=client.search_issues(
jql_str=f'project = {project} 'f'AND type != subtask 'f'AND priority = Highest 'f'AND created >= {start} AND created >= {end}',
maxResults=0
)
There is a statement if maxResults: which evaluates to false when zero and the fo.lowing elif statement sets it to a batch size of 100. I find it strange to use an int as a boolean in this way, so I wonder if this was intended.
Stack trace
In my case it was revealed during an unrelated error (notice maxResults at the end of the URL)
jira.exceptions.JIRAError: JiraError HTTP 400 url: https://redacted.net/rest/api/2/search?jql=project+%3D+PENG+AND+type+%21%3D+subtask+AND+priority+%3D+Highest+AND+created+%3E%3D+2024-01-01+AND+created+%3E%3D+2024-02-16&startAt=0&validateQuery=True&fields=%2Aall&maxResults=100
text: The value 'PENG' does not exist for the field 'project'., Field 'type' does not exist or this field cannot be viewed by anonymous users., Field 'priority' does not exist or this field cannot be viewed by anonymous users.
Expected behaviour
When I set maxResults=0 then that is what should be sent to the server.
Additional Context
No response
The text was updated successfully, but these errors were encountered:
I agree that the way this is handled probably is not the most elegant, but maybe this workaround can alleviate the pain, while people check if this misbehaviour is worth adjusting:
Set maxResult to "0" instead of 0, e.g.:
unplanned=client.search_issues(
jql_str=f'project = {project} 'f'AND type != subtask 'f'AND priority = Highest 'f'AND created >= {start} AND created >= {end}',
maxResults="0"
)
Bug summary
The API allows for specifying fewer than 50 results, so should the SDK. For example, I want to even be able to set 0 if I just want to get the count for the query result, which currently, I cannot.
Is there an existing issue for this?
Jira Instance type
Jira Cloud (Hosted by Atlassian)
Jira instance version
cloud
jira-python version
3.6.0
Python Interpreter version
3.10.6
Which operating systems have you used?
Reproduction steps
I believe the problem is here:
jira/jira/client.py
Lines 732 to 735 in 0975053
There is a statement
if maxResults:
which evaluates to false when zero and the fo.lowing elif statement sets it to a batch size of 100. I find it strange to use an int as a boolean in this way, so I wonder if this was intended.Stack trace
In my case it was revealed during an unrelated error (notice maxResults at the end of the URL)
Expected behaviour
When I set
maxResults=0
then that is what should be sent to the server.Additional Context
No response
The text was updated successfully, but these errors were encountered: