You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will add `/graphql` and `/graphiql` endpoints to your app.
48
+
This will add `/graphql` endpoint to your app and enable the GraphiQL IDE.
49
+
50
+
### Special Note for Graphene v3
51
+
52
+
If you are using the `Schema` type of [Graphene](https://github.com/graphql-python/graphene) library, be sure to use the `graphql_schema` attribute to pass as schema on the `GraphQLView` view. Otherwise, the `GraphQLSchema` from `graphql-core` is the way to go.
53
+
54
+
More info at [Graphene v3 release notes](https://github.com/graphql-python/graphene/wiki/v3-release-notes#graphene-schema-no-longer-subclasses-graphqlschema-type) and [GraphQL-core 3 usage](https://github.com/graphql-python/graphql-core#usage).
55
+
56
+
57
+
### Supported options for GraphQLView
33
58
34
-
### Supported options
35
59
*`schema`: The `GraphQLSchema` object that you want the view to execute when it gets a valid request.
36
-
*`context`: A value to pass as the `context` to the `graphql()` function.
37
-
*`root_value`: The `root_value` you want to provide to `executor.execute`.
60
+
*`context`: A value to pass as the `context_value` to graphql `execute` function. By default is set to `dict` with request object at key `request`.
61
+
*`root_value`: The `root_value` you want to provide to graphql `execute`.
38
62
*`pretty`: Whether or not you want the response to be pretty printed JSON.
39
-
*`executor`: The `Executor` that you want to use to execute queries.
40
63
*`graphiql`: If `True`, may present [GraphiQL](https://github.com/graphql/graphiql) when loaded directly from a browser (a useful tool for debugging and exploration).
64
+
*`graphiql_version`: The graphiql version to load. Defaults to **"1.0.3"**.
41
65
*`graphiql_template`: Inject a Jinja template string to customize GraphiQL.
66
+
*`graphiql_html_title`: The graphiql title to display. Defaults to **"GraphiQL"**.
42
67
*`batch`: Set the GraphQL view as batch (for using in [Apollo-Client](http://dev.apollodata.com/core/network.html#query-batching) or [ReactRelayNetworkLayer](https://github.com/nodkz/react-relay-network-layer))
43
68
*`middleware`: A list of graphql [middlewares](http://docs.graphene-python.org/en/latest/execution/middleware/).
69
+
*`encode`: the encoder to use for responses (sensibly defaults to `graphql_server.json_encode`).
70
+
*`format_error`: the error formatter to use for responses (sensibly defaults to `graphql_server.default_format_error`.
71
+
*`subscriptions`: The GraphiQL socket endpoint for using subscriptions in graphql-ws.
72
+
*`headers`: An optional GraphQL string to use as the initial displayed request headers, if not provided, the stored headers will be used.
73
+
*`default_query`: An optional GraphQL string to use when no query is provided and no stored query exists from a previous session. If not provided, GraphiQL will use its own default query.
74
+
*`header_editor_enabled`: An optional boolean which enables the header editor when true. Defaults to **false**.
75
+
*`should_persist_headers`: An optional boolean which enables to persist headers to storage when true. Defaults to **false**.
44
76
45
77
You can also subclass `GraphQLView` and overwrite `get_root_value(self, request)` to have a dynamic root value
0 commit comments