Avoid the need for breaking changes when using `Types::GlobalIdType`
To make use of Types::GlobalIdType
as an argument type, we need to either introduce a major breaking change, disrupting all clients, or we need to enable existing code to work with the new type.
What we want to get to is:
- arguments are typed as
GlobalIDType[Project]
orGlobalIDType[Issue]
or whatever - Clients are aware of this type, and name it in their queries
- The framework rejects illegal/unparseable inputs
- In our code, we get
GlobalID
instances
Since this is not fully backwards compatible (due to the second bit - clients need to be aware of it), we need a bridge to allow us to accept ID
inputs to GlobalIDType
arguments.
The major downside of this is that in Ruby-land, the value can be either a String
(if the client named it as ID
) or a GlobalID
if the client used the newer type in the query. This means that during the transition, all code that consumes these ids must be prepared for them to be either a string or a global-ID instance.
Edited by Alex Kalderimis