@@ -52,8 +52,13 @@ pip install graphql-relay
52
52
```
53
53
54
54
When building a schema for [ GraphQL] ( https://github.com/graphql-python/graphql-core ) ,
55
- the provided library functions can be used to simplify the creation of Relay
56
- patterns.
55
+ the provided library functions can be used to simplify the creation of Relay patterns.
56
+
57
+ All the functions that are explained in the following sections must be
58
+ imported from the top level of the ` graphql_relay ` package, like this:
59
+ ``` python
60
+ from graphql_relay import connection_definitions
61
+ ```
57
62
58
63
### Connections
59
64
@@ -68,11 +73,10 @@ they return a connection type.
68
73
- ` connection_from_array ` is a helper method that takes an array and the
69
74
arguments from ` connection_args ` , does pagination and filtering, and returns
70
75
an object in the shape expected by a ` connection_type ` 's ` resolver ` function.
71
-
72
76
- ` cursor_for_object_in_connection ` is a helper method that takes an array and a
73
77
member object, and returns a cursor for use in the mutation payload.
74
78
75
- An example usage of these methods from the [ test schema] ( tests/starwars/schema .py ) :
79
+ An example usage of these methods from the [ test schema] ( tests/star_wars_schema .py ) :
76
80
77
81
``` python
78
82
ship_edge, ship_connection = connection_definitions(' Ship' , shipType)
@@ -122,7 +126,7 @@ for nodes and for implementing global IDs around local IDs.
122
126
non-ID identifiers (like a username) and maps then to their corresponding
123
127
objects.
124
128
125
- An example usage of these methods from the [ test schema] ( tests/starwars/schema .py ) :
129
+ An example usage of these methods from the [ test schema] ( tests/star_wars_schema .py ) :
126
130
127
131
``` python
128
132
def get_node (global_id , _info ):
@@ -176,7 +180,7 @@ and a mutation method to map from the input fields to the output fields,
176
180
performing the mutation along the way. It then creates and returns a field
177
181
configuration that can be used as a top-level field on the mutation type.
178
182
179
- An example usage of these methods from the [ test schema] ( tests/starwars/schema .py ) :
183
+ An example usage of these methods from the [ test schema] ( tests/star_wars_schema .py ) :
180
184
181
185
``` python
182
186
class IntroduceShipMutation :
0 commit comments