Validation/coercion of input variables violates the GraphQL spec
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- graphql, python
- Domaine
- api, backend-api-design
Piste de recherche
L’issue pointe vers coerce_variable_values dans src/graphql/execution/values.py et vers le point d’entrée execute() de graphql-core. Lisez d’abord cette fonction et ses appelants ; le travail est terminé lorsque des variable_values invalides provoquent la levée de GraphQLError comme erreur de requête, sans entrée data dans la réponse.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
When callling graphql-core's execute() function with variable_values which do not pass validation -- for example, including an unexpected key in the variable_values dictionary -- the current behavior is that an ExecutionResult object is returned from the function, with the associated GraphQLError present inside it. Instead, this should be treated as a Request error, according to the spec, meaning that a GraphQLError should be raised from execute().
The GraphQL spec states:
Request errors
Request errors are raised before execution begins. This may occur due to a parse grammar or validation error in the requested document, an inability to determine which operation to execute, or invalid input values for variables.
This means that it is incorrect for the coerce_variable_values function to be returning a GraphQLError inside an ExecutionResult: https://github.com/graphql-python/graphql-core/blob/9dcf25e66f6ed36b77de788621cf50bab600d1d3/src/graphql/execution/values.py#L93-L99
doing so means that a response payload is returned containing both an "errors" key and a null "data" key. Again, this a violation of the spec:
If a request error is raised, execution does not begin and the data entry in the response must not be present. The errors entry must include the error.
- Langage dominant
- Python
- Étoiles
- 531
- Forks
- 147
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de graphql-python/graphql-core
-
Difficulté 4/5 3-5 jours Accessibilité débutants 50/100
graphql-python/graphql-core#272 · 1 commentaire ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
graphql-python/graphql-core#269 · 1 commentaire ·
-
Publish a major version Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
graphql-python/graphql-core#267 · 1 commentaire ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
graphql-python/graphql-core#257 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
graphql-python/graphql-core#247 · 8 commentaires ·
Toutes les issues de graphql-python/graphql-core
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
stephrobert/dsoxlab#238 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
sublimehq/package_control#1780 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
nwg-piotr/nwg-displays#145 ·