graphql-python / graphql-python/graphene

Field names in validation errors are different from schema

オープン
#1,126 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
8.2k
フォーク
818
PR マージ指標
30日以内にマージされた PR はありません

説明

I have a form which has a python field `raw_description` which ends up in schema as `rawDescription`. However if field doesn't have a valid value I get a validation error for field `raw_description` which is not in schema.

```python
class UpdateEventModelForm(forms.ModelForm):
raw_description = forms.CharField()
class Meta:
model = EventModel
fields = ('name', 'from_date', 'to_date')
```

```graphql
mutation updateEvent($input: UpdateEventInput!) {
updateEvent(input: $input) {
errors {
field
messages
}
}
}

{
"input": {
"id": 123,
"rawDescription": ""
}
}
```

Response

```json
{
"data": {
"updateEvent": {
"errors": [
{
"field": "raw_description",
"messages": [
"This field is required."
]
}
],
"event": null
}
}
}
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

No file or test is named in the issue. Start by tracing how Python form validation errors are converted into GraphQL responses, using the supplied raw_description/rawDescription reproduction; done means the returned error field uses the schema's rawDescription name.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
graphql, python
領域
api
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。