graphql-python / flask-graphql

Adds GraphQL support to your Flask application.
MIT License
1.33k stars 140 forks source link

Variables sent by client are not taken into account #46

Closed NiklasRosenstein closed 6 years ago

NiklasRosenstein commented 6 years ago

I'm sending a POST request with a JSON object attached that contains the query and variables. But I get an error that the variable is not defined.

image

image

I'm using Flask-GraphQL==1.4.1

app.add_url_rule('/graphql', view_func=orm.db_session(GraphQLView.as_view('graphql', schema=schema, graphiql=True)))
NiklasRosenstein commented 6 years ago

This may not be related to Flask-GraphQL at all. I've updated to the master branch where it uses graphql_server and I still have the same problem. I asked at SO: https://stackoverflow.com/questions/50814621/python-graphql-variable-not-defined

On a side-note, maybe it is partially a problem with Flask-GraphQL in version 1.4.1, because the "Variable X is not defined" comes from the validation step

https://github.com/graphql-python/flask-graphql/blob/724695aaa62e3911246ac5678d78229afefe2a6f/flask_graphql/graphqlview.py#L192-L197

And the variables are not being made known to the validate() function in any way.