Skip to content

Fix partial update for sprint should use POST #1920

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

marcotollini
Copy link

@marcotollini marcotollini requested a review from a team as a code owner November 8, 2024 17:46
@marcotollini marcotollini requested a review from adehad November 8, 2024 17:46
@github-actions github-actions bot added the bug label Nov 8, 2024
@marcotollini marcotollini changed the title Fix partial update for sprint Fix partial update for sprint should use POST Nov 8, 2024
@studioj
Copy link
Collaborator

studioj commented Nov 22, 2024

did you encounter issues? just wonderingas our tests dont really show failures with putting

@marcotollini
Copy link
Author

@studioj , yes, with PUT Jira Data Center is expecting you to define all the fields. Instead, with POST I can only define the fields that I intend to change

@studioj
Copy link
Collaborator

studioj commented Nov 24, 2024

@marcotollini can you then add a test so that the two behaviors become apparent?

Thank you

Copy link
Contributor

@adehad adehad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-rest-agile-1-0-sprint-sprintid-put

As documented here, POST is correct for a partially updated Sprint, where if the value is not set then the fields are not updated.

If someone wanted to unset the value it would be interesting. Perhaps, we can add a additional argument called partial which is default False (to preserve original behaviour), but can be set to True to do the true partial update.

@@ -5391,7 +5391,7 @@ def update_sprint(
payload["goal"] = goal

url = self._get_url(f"sprint/{id}", base=self.AGILE_BASE_URL)
r = self._session.put(url, data=json.dumps(payload))
r = self._session.post(url, data=json.dumps(payload))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
r = self._session.post(url, data=json.dumps(payload))
method = self._session.post if partial else self._session.put
r = method(url, data=json.dumps(payload))

(with corresponding addition of partial to args

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants