graphql-python / graphql-python/graphene

Field names in validation errors are different from schema

Ouverte
#1,126 7 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
8.2k
Forks
818
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
graphql, python
Domaine
api
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.