From 0964453b819938f44b07217381b18e80568273bf Mon Sep 17 00:00:00 2001 From: Cameron Hurst Date: Sun, 21 Apr 2019 09:20:56 -0400 Subject: [PATCH] Allow fields to be defined when Meta is passed in --- graphene/relay/connection.py | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/graphene/relay/connection.py b/graphene/relay/connection.py index d44e5f29..f65324bd 100644 --- a/graphene/relay/connection.py +++ b/graphene/relay/connection.py @@ -86,25 +86,19 @@ class Connection(ObjectType): options["name"] = name _meta.node = node - _meta.fields = OrderedDict( - [ - ( - "page_info", - Field( - PageInfo, - name="pageInfo", - required=True, - description="Pagination data for this connection.", - ), - ), - ( - "edges", - Field( - NonNull(List(edge)), - description="Contains the nodes in this connection.", - ), - ), - ] + 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( + NonNull(List(edge)), + description="Contains the nodes in this connection.", + ), ) return super(Connection, cls).__init_subclass_with_meta__( _meta=_meta, **options