File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 5
5
import uuid
6
6
7
7
from graphene .types .json import JSONString
8
- from graphene .utils .str_converters import to_snake_case
8
+ from graphene .utils .str_converters import to_snake_case , to_camel_case
9
9
from mongoengine .base import get_document , LazyReference
10
10
from . import advanced_types
11
11
from .utils import import_single_dispatch , get_field_description , get_query_fields
@@ -233,12 +233,10 @@ def convert_field_to_union(field, registry=None):
233
233
if len (_types ) == 0 :
234
234
return None
235
235
236
- # XXX: Use uuid to avoid duplicate name
237
- name = "{}_{}_union_{}" .format (
236
+ name = to_camel_case ("{}_{}" .format (
238
237
field ._owner_document .__name__ ,
239
- field .db_field ,
240
- str (uuid .uuid1 ()).replace ("-" , "" ),
241
- )
238
+ field .db_field
239
+ )) + "UnionType"
242
240
Meta = type ("Meta" , (object ,), {"types" : tuple (_types )})
243
241
_union = type (name , (graphene .Union ,), {"Meta" : Meta })
244
242
You can’t perform that action at this time.
0 commit comments