mirror of
https://github.com/graphql-python/graphene.git
synced 2025-04-14 14:24:14 +03:00
Add _meta explicitely
This commit is contained in:
parent
e028a7da99
commit
1406b8f960
|
@ -51,12 +51,14 @@ class Union(UnmountedType, BaseType):
|
|||
"""
|
||||
|
||||
@classmethod
|
||||
def __init_subclass_with_meta__(cls, types=None, **options):
|
||||
def __init_subclass_with_meta__(cls, types=None, _meta=None, **options):
|
||||
assert (
|
||||
isinstance(types, (list, tuple)) and len(types) > 0
|
||||
), f"Must provide types for Union {cls.__name__}."
|
||||
|
||||
_meta = options.pop("_meta", UnionOptions(cls))
|
||||
if _meta is None:
|
||||
_meta = UnionOptions(cls)
|
||||
|
||||
_meta.types = types
|
||||
super(Union, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user