The name ApplyPolicy was already registered by another type #4606
-
From @mickdelaney in #4261 I have a Gateway Service, using Stitching which sits in front of 3 downstream services. I have also added a type GlobalSettings to the Gateway itself, it then stitches that Type. I then get an error The name ApplyPolicy was already registered by another type. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
The solution: Define a public class IgnoreAuthroizeDirectiveHanlder
: IDirectiveMergeHandler
{
private readonly MergeDirectiveRuleDelegate _next;
public IgnoreAuthroizeHanlder(MergeDirectiveRuleDelegate next)
{
_next = next;
}
public void Merge(
ISchemaMergeContext context,
IReadOnlyList<IDirectiveTypeInfo> directives)
{
IDirectiveTypeInfo? directive = directives.First();
if (
!directive.Definition.Name.Value.Equals(
"authorize",
StringComparison.InvariantCultureIgnoreCase))
{
_next(context, directives);
}
}
} Add it to the schema: # Startup
services
.AddGraphQLServer()
.AddDirectiveMergeHandler<IgnoreAuthorizeDirectiveHandler>(); |
Beta Was this translation helpful? Give feedback.
The solution:
Define a
IDirectiveMergeHanlder
: