@@ -5,6 +5,7 @@ A Schema is created by supplying the root types of each type of operation, query
5
5
A schema definition is then supplied to the validator and executor.
6
6
7
7
.. code :: python
8
+
8
9
my_schema = Schema(
9
10
query = MyRootQuery,
10
11
mutation = MyRootMutation,
@@ -13,11 +14,11 @@ A schema definition is then supplied to the validator and executor.
13
14
Types
14
15
-----
15
16
16
- There are some cases where the schema could not access all the types that we plan to have.
17
- For example, when a field returns an ``Interface ``, the schema doesn't know any of the
17
+ There are some cases where the schema cannot access all of the types that we plan to have.
18
+ For example, when a field returns an ``Interface ``, the schema doesn't know about any of the
18
19
implementations.
19
20
20
- In this case, we would need to use the ``types `` argument when creating the Schema.
21
+ In this case, we need to use the ``types `` argument when creating the Schema.
21
22
22
23
23
24
.. code :: python
@@ -31,36 +32,35 @@ In this case, we would need to use the ``types`` argument when creating the Sche
31
32
Querying
32
33
--------
33
34
34
- If you need to query a schema, you can directly call the ``execute `` method on it.
35
+ To query a schema, call the ``execute `` method on it.
35
36
36
37
37
38
.. code :: python
38
-
39
+
39
40
my_schema.execute(' { lastName }' )
40
41
41
42
42
43
Auto CamelCase field names
43
44
--------------------------
44
45
45
- By default all field and argument names (that are not
46
+ By default all field and argument names (that are not
46
47
explicitly set with the ``name `` arg) will be converted from
47
- `snake_case ` to `camelCase ` (` as the API is usually being consumed by a js/mobile client ` )
48
+ `` snake_case `` to `` camelCase `` ( as the API is usually being consumed by a js/mobile client)
48
49
49
- So, for example if we have the following ObjectType
50
+ For example with the ObjectType
50
51
51
52
.. code :: python
52
53
53
54
class Person (graphene .ObjectType ):
54
55
last_name = graphene.String()
55
56
other_name = graphene.String(name = ' _other_Name' )
56
57
57
- Then the ``last_name `` field name is converted to ``lastName ``.
58
+ the ``last_name `` field name is converted to ``lastName ``.
58
59
59
- In the case we don't want to apply any transformation, we can specify
60
- the field name with the ``name `` argument. So ``other_name `` field name
61
- would be converted to ``_other_Name `` (without any other transformation).
60
+ In case you don't want to apply this transformation, provide a ``name `` argument to the field constructor.
61
+ ``other_name `` converts to ``_other_Name `` (without further transformations).
62
62
63
- So, you would need to query with:
63
+ Your query should look like
64
64
65
65
.. code ::
66
66
@@ -70,8 +70,7 @@ So, you would need to query with:
70
70
}
71
71
72
72
73
- If you want to disable this behavior, you set use the ``auto_camelcase `` argument
74
- to ``False `` when you create the Schema.
73
+ To disable this behavior, set the ``auto_camelcase `` to ``False `` upon schema instantiation.
75
74
76
75
.. code :: python
77
76
0 commit comments