diff --git a/graphene/types/uuid.py b/graphene/types/uuid.py index abb8f110..b9687e1e 100644 --- a/graphene/types/uuid.py +++ b/graphene/types/uuid.py @@ -1,5 +1,5 @@ from __future__ import absolute_import - +import six from uuid import UUID as _UUID from graphql.language import ast @@ -12,8 +12,9 @@ class UUID(Scalar): @staticmethod def serialize(uuid): - if isinstance(uuid, str): + if isinstance(uuid, six.string_types): uuid = _UUID(uuid) + assert isinstance(uuid, _UUID), "Expected UUID instance, received {}".format( uuid )