|
12 | 12 |
|
13 | 13 |
|
14 | 14 | class PageInfo(ObjectType): |
| 15 | + class Meta: |
| 16 | + description = ( |
| 17 | + "The Relay compliant `PageInfo` type, containing data necessary to" |
| 18 | + " paginate this connection." |
| 19 | + ) |
| 20 | + |
15 | 21 | has_next_page = Boolean( |
16 | 22 | required=True, |
17 | 23 | name="hasNextPage", |
@@ -64,21 +70,40 @@ class EdgeBase(object): |
64 | 70 | node = Field(_node, description="The item at the end of the edge") |
65 | 71 | cursor = String(required=True, description="A cursor for use in pagination") |
66 | 72 |
|
| 73 | + class EdgeMeta: |
| 74 | + description = "A Relay edge containing a `{}` and its cursor.".format( |
| 75 | + base_name |
| 76 | + ) |
| 77 | + |
67 | 78 | edge_name = "{}Edge".format(base_name) |
68 | 79 | if edge_class: |
69 | 80 | edge_bases = (edge_class, EdgeBase, ObjectType) |
70 | 81 | else: |
71 | 82 | edge_bases = (EdgeBase, ObjectType) |
72 | 83 |
|
73 | | - edge = type(edge_name, edge_bases, {}) |
| 84 | + edge = type(edge_name, edge_bases, {"Meta": EdgeMeta}) |
74 | 85 | cls.Edge = edge |
75 | 86 |
|
76 | 87 | options["name"] = name |
77 | 88 | _meta.node = node |
78 | 89 | _meta.fields = OrderedDict( |
79 | 90 | [ |
80 | | - ("page_info", Field(PageInfo, name="pageInfo", required=True)), |
81 | | - ("edges", Field(NonNull(List(edge)))), |
| 91 | + ( |
| 92 | + "page_info", |
| 93 | + Field( |
| 94 | + PageInfo, |
| 95 | + name="pageInfo", |
| 96 | + required=True, |
| 97 | + description="Pagination data for this connection.", |
| 98 | + ), |
| 99 | + ), |
| 100 | + ( |
| 101 | + "edges", |
| 102 | + Field( |
| 103 | + NonNull(List(edge)), |
| 104 | + description="Contains the nodes in this connection.", |
| 105 | + ), |
| 106 | + ), |
82 | 107 | ] |
83 | 108 | ) |
84 | 109 | return super(Connection, cls).__init_subclass_with_meta__( |
|
0 commit comments