graphql-python / graphql-python/graphene

When sending multiple invalid values, response errors only contains the first failure

Abierto
#1,164 4 comentarios 0 reacciones 0 asignados Ver en GitHub
🐛 bug
Lenguaje dominante
Python
Estrellas
8.2k
Forks
818
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

using graphene-2.1.8
When passing query data to the below query
we only get one error when two are expected
```
class SubscriptionPlanObjects(graphene.ObjectType):
subscription_plan_objects = graphene.List(
graphene.NonNull(graphql.SubscriptionPlanObject),
subscriber_id=graphene.Int(required=True),
subscriber_type=graphene.String(required=True),
target_currency=graphene.String(required=True),
)

def resolve_subscription_plan_objects(
self, info, subscriber_id, subscriber_type, target_currency
):
pass

query = """
query subscriptionPlanObjects ($subscriberId: Int!, $subscriberType: String!, $targetCurrency: String!) {
subscriptionPlanObjects (subscriberId: $subscriberId, subscriberType: $subscriberType, targetCurrency: $targetCurrency) {
id
}
}
"""
test_schema = build_schema(query=SubscriptionPlanObjects)
gql_client = Client(test_schema)
response = gql_client.execute(self.query, variables=kwargs)
```
data like:
```
kwargs = {
"subscriberId": None,
"subscriberType": 3,
"targetCurrency": "usd"
}
```
We only get the one error, response["errors"] is
```
[
{
'locations': [{'column': 40, 'line': 2}],
'message': 'Variable "$subscriberId" of required type "Int!" was not provided.'
}
]
```
When we should also get an error on the subscriberType argument because it is not type String!

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza con los puntos de entrada proporcionados build_schema y Client.execute, y luego sigue cómo se fuerzan y se notifican las variables de consulta cuando varios valores no son válidos. Reproduce el ejemplo con subscriberId establecido en None y subscriberType establecido en 3; se considera completado cuando response["errors"] contiene ambos errores de validación.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
api
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.