mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-22 01:26:49 +03:00
Set any arbitrary meta fields onto the meta instance
This commit is contained in:
parent
60a9609b9a
commit
12d8ef813c
|
@ -40,6 +40,11 @@ class BaseType(SubclassWithMeta):
|
|||
return
|
||||
_meta.name = name or cls.__name__
|
||||
_meta.description = description or trim_docstring(cls.__doc__)
|
||||
|
||||
# Set all extra arguments onto the meta class as well
|
||||
for key, value in _kwargs.items():
|
||||
setattr(_meta, key, value)
|
||||
|
||||
_meta.freeze()
|
||||
cls._meta = _meta
|
||||
super(BaseType, cls).__init_subclass_with_meta__()
|
||||
|
|
|
@ -275,3 +275,12 @@ def test_objecttype_meta_with_annotations():
|
|||
|
||||
schema = Schema(query=Query)
|
||||
assert schema is not None
|
||||
|
||||
|
||||
def test_objecttype_meta_extra_fields():
|
||||
class Query(ObjectType):
|
||||
class Meta:
|
||||
name = "MyQuery"
|
||||
foo = "bar"
|
||||
|
||||
assert Query._meta.foo == "bar"
|
||||
|
|
Loading…
Reference in New Issue
Block a user