You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to rename the type of an enum used for input in my API while keeping the values the same, but I need to make sure it doesn't break backwards compatibility for old clients. I tried using a graphene.Union of the old and new enums as below, but that throws an error.
class OldStatus(graphene.Enum): # DEPRECATED NAME
VAL = 'VAL'
class NewStatus(graphene.Enum):
VAL = 'VAL'
class BackwardsCompatibleNewStatus(graphene.Union):
class Meta:
types = (OldStatus, NewStatus)
Is there a way to union 2 enum types so that I can allow the API to accept both types while the client is migrated? Or, is there a way to rewrite the requests as the come in to graphene so that whenever it sees OldStatus it replaces it with NewStatus so everything keeps working? Or alias OldStatus to NewStatus somehow? The issue is that requests come in looking like:
So even though OldStatus and NewStatus are identical, graphene rejects the request because the name of the enum type is OldStatus instead of NewStatus.
In the meantime I've hacked around the issue by extending graphene.Schema like below, but it'd be great if there was a less hacky way to accomplish this:
I want to rename the type of an enum used for input in my API while keeping the values the same, but I need to make sure it doesn't break backwards compatibility for old clients. I tried using a
graphene.Union
of the old and new enums as below, but that throws an error.Is there a way to union 2 enum types so that I can allow the API to accept both types while the client is migrated? Or, is there a way to rewrite the requests as the come in to graphene so that whenever it sees
OldStatus
it replaces it withNewStatus
so everything keeps working? Or aliasOldStatus
toNewStatus
somehow? The issue is that requests come in looking like:So even though
OldStatus
andNewStatus
are identical, graphene rejects the request because the name of the enum type isOldStatus
instead ofNewStatus
.In the meantime I've hacked around the issue by extending
graphene.Schema
like below, but it'd be great if there was a less hacky way to accomplish this:The text was updated successfully, but these errors were encountered: