Refactor ID to add formatter via placeholder #4669
Labels
Area: Relay
Issue is related to the Relay integration
🎉 enhancement
New feature or request
🌶️ hot chocolate
Milestone
Is your feature request related to a problem?
It's currently impossible (AFAIK) to determine whether an argument / input field has been setup as an
ID
field in cases where the[ID]
attribute isn't used (which can be spotted in reflection).Currently the way that polymorphic ids library does it is to look for the attribute, but we can't support fluent-style setup using
.ID()
Code.
The ID descriptor extensions set it up in
OnBeforeCompleteType
, so I can't look for theGlobalIdInputFormatter
on args to know if the arg/field is an ID (and insert mine before it). There's essentially a race condition.The solution you'd like
On a call Michael said it'd be good to refactor this to use the same technique that some field middleware is added, like UsePaging, by having the extension method insert a placeholder formatter and swapping the real one in later in the type interceptor.
WellKnownFormatterNames/WellKnownFormatterTypes.GlobalIdInputValueFormatter
would mean we could look for it as an external library.Alternatively, all the ID descriptor extensions could add a flag into the temporary context data I suppose.
Product
Hot Chocolate
The text was updated successfully, but these errors were encountered: