Expose content_version for optimistic locking on issue and PR edits (#37035)
- Add `content_version` field to Issue and PullRequest API responses
- Accept optional `content_version` in `PATCH
/repos/{owner}/{repo}/issues/{index}` and `PATCH
/repos/{owner}/{repo}/pulls/{index}` — returns 409 Conflict when stale,
succeeds silently when omitted (backward compatible)
- Pre-check `content_version` before any mutations to prevent partial
writes (e.g. title updated but body rejected)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
21
templates/swagger/v1_json.tmpl
generated
21
templates/swagger/v1_json.tmpl
generated
@@ -10362,6 +10362,7 @@
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"description": "Pass `content_version` to enable optimistic locking on body edits.\nIf the version doesn't match the current value, the request fails with 409 Conflict.\n",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -24766,6 +24767,11 @@
|
||||
"type": "string",
|
||||
"x-go-name": "Body"
|
||||
},
|
||||
"content_version": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "ContentVersion"
|
||||
},
|
||||
"due_date": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
@@ -24938,6 +24944,11 @@
|
||||
"type": "string",
|
||||
"x-go-name": "Body"
|
||||
},
|
||||
"content_version": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "ContentVersion"
|
||||
},
|
||||
"due_date": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
@@ -26223,6 +26234,11 @@
|
||||
"format": "int64",
|
||||
"x-go-name": "Comments"
|
||||
},
|
||||
"content_version": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "ContentVersion"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
@@ -27725,6 +27741,11 @@
|
||||
"format": "int64",
|
||||
"x-go-name": "Comments"
|
||||
},
|
||||
"content_version": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "ContentVersion"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
|
||||
Reference in New Issue
Block a user