KnpLabs / KnpLabs/php-github-api

Error when adding a label to an issue

未关闭
#1,035 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
PHP
星标
2.2k
派生
587
PR 合并指标
30 天内没有已合并 PR

描述

Hello,

I have an error when I try to add a label on an issue, following [this documentation](https://github.com/KnpLabs/php-github-api/blob/master/doc/issue/labels.md#add-a-label-on-an-issue).

Here is how I do it:

```php
$labels = $client->api('issue')->labels()->add('matthieu-rolland', 'test-issuebot', 51, 'Fixed');
```

And here is what I get:

`PHP Fatal error: Uncaught Github\Exception\RuntimeException: Invalid request.
No subschema in "anyOf" matched.
`

When I debug I see that the response I get is actually:

`ERROR 422 Unprocessable Entity`

I didn't manage to identify the cause of this problem...

**Some more information:**

- It does work when I call github's API directly via postman with the same github token
- While debugging I saw that the URI and HTTP methods seem correct (but maybe not until the end?)
- I'm not sure about the request's body
- VERSION 2.12.1

贡献指南

这个仓库没有索引到贡献指南

调研方向

Start with the add-a-label example in the linked issue-labels documentation and the PHP call shown for version 2.12.1. Compare the request body and response handling with the successful Postman request; done means adding the label no longer produces the 422 Invalid request error.

由索引模型根据 Issue 内容生成。

评估

技术栈
github, php
领域
api
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。