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
For POST /repos/{owner}/{repo}/issues/{issue_number}/labels, the description is currently
Adds labels to an issue. If you provide an empty array of labels, all labels are removed from the issue.
and the requestBody is documented as
The names of the labels to add to the issue's existing labels. You can pass an empty array to remove all labels. Alternatively, you can pass a single label as a string or an array of labels directly, but GitHub recommends passing an object with the labels key. You can also replace all of the labels for an issue. For more information, see "Set labels for an issue.
and the schema specifies, in effect:
a lone $string
an array of $strings
an array of {name: $string}
an object with a single property labels whose value is an array of strings
an object with a single property labels whose value is an array of {name: $string}
incorrect description
First off, the descriptions (of both the endpoint and the requestBody) assert that passing an empty array will remove all the labels, this does not happen, it may have been copied over from the "set labels for an issue" endpoint.
incorrect minItems
On every array, the schema declares minItems: 1, this seems to be untrue for form (2) / (3) which does accept an empty array (it just does nothing), it is true for form 4/5
(1) is not valid
Trying to pass a naked string to the endpoint results in a validation error:
{"message":"Invalid request.\n\nNo subschema in \"anyOf\" matched.\nFor 'anyOf/0', \"test\" is not an array.\nFor 'anyOf/1', \"test\" is not an array.\nFor 'anyOf/2', \"test\" is not an object.","documentation_url":"https://docs.github.com/rest/issues/labels#add-labels-to-an-issue"}
(5) is not valid
Trying to pass a nested record results in a validation error:
r = session.post(
f'{pr.issue_url}/labels',
json={"labels": [{"name": "test"}]},
)
=>
{"message":"Invalid request.\n\nNo subschema in \"anyOf\" matched.\nFor 'anyOf/0', {\"labels\"=>[{\"name\"=>\"test\"}]} is not an array.\nFor 'anyOf/1', {\"labels\"=>[{\"name\"=>\"test\"}]} is not an array.\nFor 'items', {\"name\"=>\"test\"} is not a string.","documentation_url":"https://docs.github.com/rest/issues/labels#add-labels-to-an-issue"}
The text was updated successfully, but these errors were encountered:
Complement: "set issue labels" (PUT on the same endpoint) seems to have fairly similar but not identical issues:
request bodies (1) and (5) are also invalid despite (1) being documented in the description and (5) being in the schema
unlike POST, case (4) with an empty array is valid and behaves the same as (2): as documented, passing an empty array does clear out the current labels of the issue so minItems is wrong for 4 (and 5) as well as 2 and 3.
Schema Inaccuracy
For
POST /repos/{owner}/{repo}/issues/{issue_number}/labels
, the description is currentlyand the requestBody is documented as
and the
schema
specifies, in effect:{name: $string}
labels
whose value is an array of stringslabels
whose value is an array of{name: $string}
incorrect description
First off, the descriptions (of both the endpoint and the requestBody) assert that passing an empty array will remove all the labels, this does not happen, it may have been copied over from the "set labels for an issue" endpoint.
incorrect minItems
On every array, the schema declares
minItems: 1
, this seems to be untrue for form (2) / (3) which does accept an empty array (it just does nothing), it is true for form 4/5(1) is not valid
Trying to pass a naked string to the endpoint results in a validation error:
=>
(5) is not valid
Trying to pass a nested record results in a validation error:
=>
The text was updated successfully, but these errors were encountered: