-
-
Notifications
You must be signed in to change notification settings - Fork 142
Open
Assignees
@dcreekp
Description
Reporting issues with GraphQL-core 3
I came across an issue that may be due to Graphene but the problem surfaces here.
I was writing a mutation which would raise an Error or return:
{"data": {"someMutationThatReturnsNone": None}
instead of something like:
{"data": {"someMutationThatWillAlwaysBeTrueIfNoErrorRaised": {"success": True}}}
I was happy that this worked:
class SomeMutationThatReturnsNone(graphene.Mutation): class Arguments: ... Output = CustomNullTypeScalar def mutate(self, info: graphene.ResolveInfo, **kwargs: Any) -> None: ... return None
until I realised that this would also work:
class SomeMutationThatReturnsNone(graphene.Mutation): class Arguments: ... Output = graphene.Date(required=True) def mutate(self, info: graphene.ResolveInfo, **kwargs: Any) -> None: ... return None
currently, because the line of code linked above is before the check if is_leaf_type(return_type)
, so long as Output = someScalarOrEnumType
the mutation will return {"data": {"someMutationThatReturnsNone": None}
.
Which I don't think is right.
Would appreciate your thoughts.