fix(api): keep milestone due date when it is omitted in edit request (#39869)

`PATCH /repos/{owner}/{repo}/milestones/{id}` always overwrote the due
date with `due_on`, so a request that only changed other fields, such as
`{"state": "closed"}`, silently removed it.

The due date is now kept when `due_on` is omitted, and `"due_on": null`
or `"due_on": ""` remove it.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Shudhanshu Singhandwxiaoguang authored and GitHub committed 2026-10-21 18:52:33 +08:00
1 parent b5e53210c2
commit a8e1057f5e
15 files changed
+192 -74

No files matched your search

+6 -6
View File
@@ -5562,17 +5562,15 @@
"x-go-package": "gitea.dev/modules/structs"
},
"EditDeadlineOption": {
"description": "EditDeadlineOption options for creating a deadline",
"description": "EditDeadlineOption options for editing a deadline",
"properties": {
"due_date": {
"description": "Deadline is the updated due date for the issue or pull request, use null or empty string to remove the deadline",
"format": "date-time",
"type": "string",
"x-go-name": "Deadline"
}
},
"required": [
"due_date"
],
"type": "object",
"x-go-package": "gitea.dev/modules/structs"
},
@@ -5673,6 +5671,7 @@
"x-go-name": "ContentVersion"
},
"due_date": {
"description": "Deadline is the updated due date for the issue, use null or empty string to remove the deadline",
"format": "date-time",
"type": "string",
"x-go-name": "Deadline"
@@ -5752,7 +5751,7 @@
"x-go-name": "Description"
},
"due_on": {
"description": "Deadline is the updated due date for the milestone",
"description": "Deadline is the due date for the milestone, use null or empty string to remove the deadline",
"format": "date-time",
"type": "string",
"x-go-name": "Deadline"
@@ -5902,6 +5901,7 @@
"x-go-name": "ContentVersion"
},
"due_date": {
"description": "Deadline is the updated due date for the pull request, use null or empty string to remove the deadline",
"format": "date-time",
"type": "string",
"x-go-name": "Deadline"
@@ -7948,7 +7948,7 @@
"x-go-package": "gitea.dev/modules/structs"
},
"Milestone": {
"description": "Milestone milestone is a collection of issues on one repository",
"description": "Milestone is a collection of issues on one repository",
"properties": {
"closed_at": {
"format": "date-time",
+6 -6
View File
@@ -28658,13 +28658,11 @@
"x-go-package": "gitea.dev/modules/structs"
},
"EditDeadlineOption": {
"description": "EditDeadlineOption options for creating a deadline",
"description": "EditDeadlineOption options for editing a deadline",
"type": "object",
"required": [
"due_date"
],
"properties": {
"due_date": {
"description": "Deadline is the updated due date for the issue or pull request, use null or empty string to remove the deadline",
"type": "string",
"format": "date-time",
"x-go-name": "Deadline"
@@ -28769,6 +28767,7 @@
"x-go-name": "ContentVersion"
},
"due_date": {
"description": "Deadline is the updated due date for the issue, use null or empty string to remove the deadline",
"type": "string",
"format": "date-time",
"x-go-name": "Deadline"
@@ -28848,7 +28847,7 @@
"x-go-name": "Description"
},
"due_on": {
"description": "Deadline is the updated due date for the milestone",
"description": "Deadline is the due date for the milestone, use null or empty string to remove the deadline",
"type": "string",
"format": "date-time",
"x-go-name": "Deadline"
@@ -29008,6 +29007,7 @@
"x-go-name": "ContentVersion"
},
"due_date": {
"description": "Deadline is the updated due date for the pull request, use null or empty string to remove the deadline",
"type": "string",
"format": "date-time",
"x-go-name": "Deadline"
@@ -31055,7 +31055,7 @@
"x-go-package": "gitea.dev/modules/structs"
},
"Milestone": {
"description": "Milestone milestone is a collection of issues on one repository",
"description": "Milestone is a collection of issues on one repository",
"type": "object",
"properties": {
"closed_at": {