mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-18 03:52:24 +03:00
Pass extra kwargs down the meta chain
This commit is contained in:
parent
bf034ca85f
commit
2bd3e61c6b
|
@ -20,12 +20,14 @@ class ObjectTypeOptions(BaseOptions):
|
|||
|
||||
|
||||
class ObjectTypeMeta(BaseTypeMeta):
|
||||
def __new__(cls, name, bases, namespace):
|
||||
def __new__(cls, name, bases, namespace, **kwargs):
|
||||
# We create this type, to then overload it with the dataclass attrs
|
||||
class InterObjectType:
|
||||
pass
|
||||
|
||||
base_cls = super().__new__(cls, name, (InterObjectType,) + bases, namespace)
|
||||
base_cls = super().__new__(
|
||||
cls, name, (InterObjectType,) + bases, namespace, **kwargs
|
||||
)
|
||||
if base_cls._meta:
|
||||
fields = [
|
||||
(
|
||||
|
|
|
@ -295,3 +295,14 @@ def test_objecttype_meta_with_annotations():
|
|||
|
||||
schema = Schema(query=Query)
|
||||
assert schema is not None
|
||||
|
||||
|
||||
def test_objecttype_meta_arguments():
|
||||
class MyInterface(Interface):
|
||||
foo = String()
|
||||
|
||||
class MyType(ObjectType, interfaces=[MyInterface]):
|
||||
bar = String()
|
||||
|
||||
assert MyType._meta.interfaces == [MyInterface]
|
||||
assert list(MyType._meta.fields.keys()) == ["foo", "bar"]
|
||||
|
|
Loading…
Reference in New Issue
Block a user