Added Support colons in legacy GIDs #7304
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While preparing our Framework code for Hot Chocolate v14, I noticed that we have some (strongly typed) Ids that contain colons (
:
). This is problematic with the current implementation of the new Node Id Serializer, as it looks for:
as the separator between Type name and Id value and doesn't consider that it might be dealing with a legacy Id that contains a colon.This PR adds support for colons in Id values by looking for both the new
:
and old\n
delimiter.This of course impacts the hot path, but I think it's warranted. If someone were to implement a custom Id format (doesn't even have to be strongly typed, it could just be a string with another dalimiter) I would assume that the delimiter being chosen would be
:
95% of the time. I'd therefore assume that there is probably at least one such Id in each larger code base. I think it would be really nice, if the new solution would be a drop-in replacement and wouldn't require any migration effort.