File tree 1 file changed +50
-0
lines changed
1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ title : Introspection Schema
3
+ description : A guide to instrospection schema in Django
4
+ ---
5
+
6
+ # Introspection Schema
7
+
8
+ Relay uses [ Babel Relay Plugin] ( https://facebook.github.io/relay/docs/guides-babel-plugin.html )
9
+ that requires you to provide your GraphQL schema data.
10
+
11
+ Graphene comes with a management command for Django to dump your schema data to
12
+ ` schema.json ` that is compatible with babel-relay-plugin.
13
+
14
+
15
+ ## Usage
16
+
17
+ Include ` graphene.django.contrib ` to ` INSTALLED_APPS ` in you project settings:
18
+
19
+ ``` python
20
+ INSTALLED_APPS += (' graphene.django.contrib' )
21
+ ```
22
+
23
+ Assuming your Graphene schema is at ` tutorial.quickstart.schema ` , run the command:
24
+
25
+ ``` bash
26
+ ./manage.py graphql_schema --schema tutorial.quickstart.schema --out schema.json
27
+ ```
28
+
29
+ It dumps your full introspection schema to ` schema.json ` inside your project root
30
+ directory. Point ` babel-relay-plugin ` to this file and you're ready to use Relay
31
+ with Graphene GraphQL implementation.
32
+
33
+
34
+ ## Advanced Usage
35
+
36
+ To simplify the command to ` ./manage.py graphql_schema ` , you can specify the
37
+ parameters in your settings.py:
38
+
39
+ ``` python
40
+ GRAPHENE_SCHEMA = ' tutorial.quickstart.schema'
41
+ GRAPHENE_SCHEMA_OUTPUT = ' data/schema.json' # defaults to schema.json
42
+ ```
43
+
44
+ Running ` ./manage.py graphql_schema ` dumps your schema to
45
+ ` <project root>/data/schema.json ` .
46
+
47
+
48
+ ## Help
49
+
50
+ Run ` ./manage.py graphql_schema -h ` for command usage.
You can’t perform that action at this time.
0 commit comments