graphql-python / graphql-python/graphene

Field names in validation errors are different from schema

Offen
#1,126 7 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
8.2k
Forks
818
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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
}
}
}
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.