Allow fields to be defined when Meta is passed in

This commit is contained in:
Cameron Hurst 2019-04-21 09:20:56 -04:00
parent 32565ef39b
commit 0964453b81
No known key found for this signature in database
GPG Key ID: 21D8849D8BAFABCA

View File

@ -86,25 +86,19 @@ class Connection(ObjectType):
options["name"] = name
_meta.node = node
_meta.fields = OrderedDict(
[
(
"page_info",
Field(
if not _meta.fileds:
_meta.fields = OrderedDict()
_meta.fields.update(
page_info=Field(
PageInfo,
name="pageInfo",
required=True,
description="Pagination data for this connection.",
),
),
(
"edges",
Field(
edges=Field(
NonNull(List(edge)),
description="Contains the nodes in this connection.",
),
),
]
)
return super(Connection, cls).__init_subclass_with_meta__(
_meta=_meta, **options