mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-02 13:44:16 +09:00
fix(api): edit and delete repository labels by name (#39974)
Repo and org label endpoints accepted a label name for GET but only a
numeric ID for PATCH and DELETE, which breaks label-sync style tools.
- PATCH and DELETE on `/repos/{owner}/{repo}/labels/{id}` and
`/orgs/{org}/labels/{id}` accept a label name when the value is not
numeric, numeric values stay IDs
- A name shared by several labels returns 400 instead of acting on an
arbitrary one
- Deleting a missing label returns 404 instead of 204
- The swagger `id` parameter of these endpoints is now a string
Fixes: https://github.com/go-gitea/gitea/issues/34937
Co-authored-by: Hello-Liar <80651389+Hello-Liar@users.noreply.github.com>
Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
7 files changed
+100
-107
No files matched your search
+12
-18
@@ -14503,13 +14503,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "id of the label to delete",
|
||||
"description": "id of the label to delete, or its name when not numeric",
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"format": "int64",
|
||||
"type": "integer"
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -14539,13 +14538,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "id of the label to get",
|
||||
"description": "id of the label to get, or its name when not numeric",
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"format": "int64",
|
||||
"type": "integer"
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -14575,13 +14573,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "id of the label to edit",
|
||||
"description": "id of the label to edit, or its name when not numeric",
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"format": "int64",
|
||||
"type": "integer"
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -26676,13 +26673,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "id of the label to delete",
|
||||
"description": "id of the label to delete, or its name when not numeric",
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"format": "int64",
|
||||
"type": "integer"
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -26721,13 +26717,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "id of the label to get",
|
||||
"description": "id of the label to get, or its name when not numeric",
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"format": "int64",
|
||||
"type": "integer"
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -26766,13 +26761,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "id of the label to edit",
|
||||
"description": "id of the label to edit, or its name when not numeric",
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"format": "int64",
|
||||
"type": "integer"
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
+12
-18
@@ -3095,9 +3095,8 @@
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "id of the label to get",
|
||||
"type": "string",
|
||||
"description": "id of the label to get, or its name when not numeric",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -3127,9 +3126,8 @@
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "id of the label to delete",
|
||||
"type": "string",
|
||||
"description": "id of the label to delete, or its name when not numeric",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -3165,9 +3163,8 @@
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "id of the label to edit",
|
||||
"type": "string",
|
||||
"description": "id of the label to edit, or its name when not numeric",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -14239,9 +14236,8 @@
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "id of the label to get",
|
||||
"type": "string",
|
||||
"description": "id of the label to get, or its name when not numeric",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -14278,9 +14274,8 @@
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "id of the label to delete",
|
||||
"type": "string",
|
||||
"description": "id of the label to delete, or its name when not numeric",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -14323,9 +14318,8 @@
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "id of the label to edit",
|
||||
"type": "string",
|
||||
"description": "id of the label to edit, or its name when not numeric",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
|
||||
Reference in new issue
Block a user