Skip to content

Commit dda3237

Browse files
authored
Merge pull request #318 from ksonj/master
Fixed typos and improved language and markup
2 parents edd090e + dda294d commit dda3237

File tree

7 files changed

+49
-56
lines changed

7 files changed

+49
-56
lines changed

docs/quickstart.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ server with an associated set of resolve methods that know how to fetch
3030
data.
3131

3232
We are going to create a very simple schema, with a ``Query`` with only
33-
one field: ``hello``. And when we query it should return ``"World"``.
33+
one field: ``hello``. And when we query it, it should return ``"World"``.
3434

3535
.. code:: python
3636
@@ -47,7 +47,7 @@ one field: ``hello``. And when we query it should return ``"World"``.
4747
Querying
4848
--------
4949

50-
Then, we can start querying our schema:
50+
Then we can start querying our schema:
5151

5252
.. code:: python
5353

docs/types/abstracttypes.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
AbstractTypes
22
=============
33

4-
An AbstractType contains fields that could be shared among
4+
An AbstractType contains fields that can be shared among
55
``graphene.ObjectType``, ``graphene.Interface``,
66
``graphene.InputObjectType`` or other ``graphene.AbstractType``.
77

88
The basics:
99

1010
- Each AbstractType is a Python class that inherits from ``graphene.AbstractType``.
11-
- Each attribute of the AbstractType represents a field (could be a ``graphene.Field`` or
12-
``graphene.InputField`` depending on where is mounted)
11+
- Each attribute of the AbstractType represents a field (a ``graphene.Field`` or
12+
``graphene.InputField`` depending on where it is mounted)
1313

1414
Quick example
1515
-------------
1616

1717
In this example UserFields is an ``AbstractType`` with a name. ``User`` and
18-
``UserInput`` are two types that will have their own fields
18+
``UserInput`` are two types that have their own fields
1919
plus the ones defined in ``UserFields``.
2020

2121
.. code:: python

docs/types/enums.rst

+5-7
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ needs to have the ``description`` property on it.
4747
Usage with Python Enums
4848
-----------------------
4949

50-
In case that the Enums are already defined it's possible to reuse them using
50+
In case the Enums are already defined it's possible to reuse them using
5151
the ``Enum.from_enum`` function.
5252

5353
.. code:: python
@@ -58,10 +58,8 @@ the ``Enum.from_enum`` function.
5858
Notes
5959
-----
6060

61-
Internally, ``graphene.Enum`` uses `enum.Enum`_ Python
62-
implementation if available, or a backport if not.
61+
``graphene.Enum`` uses |enum.Enum|_ internally (or a backport if
62+
that's not available) and can be used in the exact same way.
6363

64-
So you can use it in the same way as you would do with Python
65-
``enum.Enum``.
66-
67-
.. _``enum.Enum``: https://docs.python.org/3/library/enum.html
64+
.. |enum.Enum| replace:: ``enum.Enum``
65+
.. _enum.Enum: https://docs.python.org/3/library/enum.html

docs/types/interfaces.rst

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Interfaces
22
==========
33

4-
An Interface contains the essential fields that will be implemented among
4+
An Interface contains the essential fields that will be implemented by
55
multiple ObjectTypes.
66

77
The basics:
@@ -12,8 +12,8 @@ The basics:
1212
Quick example
1313
-------------
1414

15-
This example model defines a Character, which has a name. ``Human`` and
16-
``Droid`` are two of the Interface implementations.
15+
This example model defines a ``Character`` interface with a name. ``Human``
16+
and ``Droid`` are two implementations of that interface.
1717

1818
.. code:: python
1919
@@ -37,12 +37,11 @@ This example model defines a Character, which has a name. ``Human`` and
3737
function = graphene.String()
3838
3939
40-
**name** is a field in the ``Character`` interface that will be in both
41-
``Human`` and ``Droid`` ObjectTypes (as those implement the ``Character``
42-
interface). Each ObjectType also define extra fields at the same
43-
time.
40+
``name`` is a field on the ``Character`` interface that will also exist on both
41+
the ``Human`` and ``Droid`` ObjectTypes (as those implement the ``Character``
42+
interface). Each ObjectType may define additional fields.
4443

45-
The above types would have the following representation in a schema:
44+
The above types have the following representation in a schema:
4645

4746
.. code::
4847

docs/types/objecttypes.rst

+13-16
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ querying.
77

88
The basics:
99

10-
- Each ObjectType is a Python class that inherits
10+
- Each ObjectType is a Python class that inherits from
1111
``graphene.ObjectType``.
1212
- Each attribute of the ObjectType represents a ``Field``.
1313

1414
Quick example
1515
-------------
1616

17-
This example model defines a Person, which has a first\_name and
18-
last\_name:
17+
This example model defines a Person, with a first and a last name:
1918

2019
.. code:: python
2120
@@ -33,8 +32,7 @@ last\_name:
3332
field is specified as a class attribute, and each attribute maps to a
3433
Field.
3534

36-
The above ``Person`` ObjectType would have the following representation
37-
in a schema:
35+
The above ``Person`` ObjectType has the following schema representation:
3836

3937
.. code::
4038
@@ -48,16 +46,15 @@ in a schema:
4846
Resolvers
4947
---------
5048

51-
A resolver is a method that resolves certain field within a
52-
``ObjectType``. The resolver of a field will be, if not specified
53-
otherwise, the ``resolve_{field_name}`` within the ``ObjectType``.
49+
A resolver is a method that resolves certain fields within a
50+
``ObjectType``. If not specififed otherwise, the resolver of a
51+
field is the ``resolve_{field_name}`` method on the ``ObjectType``.
5452

55-
By default a resolver will take the ``args``, ``context`` and ``info``
56-
arguments.
53+
By default resolvers take the arguments ``args``, ``context`` and ``info``.
5754

58-
NOTE: The class resolvers in a ``ObjectType`` are treated as ``staticmethod``s
59-
always, so the first argument in the resolver: ``self`` (or ``root``) doesn't
60-
need to be an actual instance of the ``ObjectType``.
55+
NOTE: The resolvers on a ``ObjectType`` are always treated as ``staticmethod``s,
56+
so the first argument to the resolver method ``self`` (or ``root``) need
57+
not be an actual instance of the ``ObjectType``.
6158

6259

6360
Quick example
@@ -81,7 +78,7 @@ method in the class.
8178
Resolvers outside the class
8279
~~~~~~~~~~~~~~~~~~~~~~~~~~~
8380

84-
A field could also specify a custom resolver outside the class:
81+
A field can use a custom resolver from outside the class:
8582

8683
.. code:: python
8784
@@ -98,8 +95,8 @@ A field could also specify a custom resolver outside the class:
9895
Instances as data containers
9996
----------------------------
10097

101-
Graphene ``ObjectType``\ s could act as containers too. So with the
102-
previous example you could do.
98+
Graphene ``ObjectType``\ s can act as containers too. So with the
99+
previous example you could do:
103100

104101
.. code:: python
105102

docs/types/scalars.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Graphene also provides custom scalars for Dates, Times, and JSON:
1919
Custom scalars
2020
--------------
2121

22-
You can create a custom scalar for your schema.
22+
You can create custom scalars for your schema.
2323
The following is an example for creating a DateTime scalar:
2424

2525
.. code:: python
@@ -48,8 +48,8 @@ The following is an example for creating a DateTime scalar:
4848
Mounting Scalars
4949
----------------
5050

51-
If a scalar is mounted in an ``ObjectType``, ``Interface`` or
52-
``Mutation``, they act as ``Field``\ s:
51+
Scalars mounted in a ``ObjectType``, ``Interface`` or ``Mutation`` act as
52+
``Field``\ s.
5353

5454
.. code:: python
5555
@@ -64,8 +64,8 @@ If a scalar is mounted in an ``ObjectType``, ``Interface`` or
6464
**Note:** when using the ``Field`` constructor directly, pass the type and
6565
not an instance.
6666

67+
Types mounted in a ``Field`` act as ``Argument``\ s.
6768

68-
If the types are mounted in a ``Field``, they act as ``Argument``\ s:
6969

7070
.. code:: python
7171

docs/types/schema.rst

+14-15
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ A Schema is created by supplying the root types of each type of operation, query
55
A schema definition is then supplied to the validator and executor.
66

77
.. code:: python
8+
89
my_schema = Schema(
910
query=MyRootQuery,
1011
mutation=MyRootMutation,
@@ -13,11 +14,11 @@ A schema definition is then supplied to the validator and executor.
1314
Types
1415
-----
1516

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
1819
implementations.
1920

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.
2122

2223

2324
.. code:: python
@@ -31,36 +32,35 @@ In this case, we would need to use the ``types`` argument when creating the Sche
3132
Querying
3233
--------
3334

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.
3536

3637

3738
.. code:: python
38-
39+
3940
my_schema.execute('{ lastName }')
4041
4142
4243
Auto CamelCase field names
4344
--------------------------
4445

45-
By default all field and argument names (that are not
46+
By default all field and argument names (that are not
4647
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)
4849

49-
So, for example if we have the following ObjectType
50+
For example with the ObjectType
5051

5152
.. code:: python
5253
5354
class Person(graphene.ObjectType):
5455
last_name = graphene.String()
5556
other_name = graphene.String(name='_other_Name')
5657
57-
Then the ``last_name`` field name is converted to ``lastName``.
58+
the ``last_name`` field name is converted to ``lastName``.
5859

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).
6262

63-
So, you would need to query with:
63+
Your query should look like
6464

6565
.. code::
6666
@@ -70,8 +70,7 @@ So, you would need to query with:
7070
}
7171
7272
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.
7574

7675
.. code:: python
7776

0 commit comments

Comments
 (0)