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