public static ISchemaBuilder AddDirectiveType( this ISchemaBuilder builder, string name, DirectiveLocation location, Func <IDirectiveTypeDescriptor, IDirectiveTypeDescriptor> configure) => builder.AddDirectiveType(new DirectiveType(x => configure(x.Name(name).Location(location))));
public static void RegisterDirective( this ISchemaConfiguration context, string name, DirectiveLocation location, Func <IDirectiveTypeDescriptor, IDirectiveTypeDescriptor> configure) => context.RegisterDirective(new DirectiveType(x => configure(x.Name(name).Location(location))));
private static bool TryLookupLocation(ISyntaxNode node, out DirectiveLoc location) { switch (node.Kind) { case NodeKind.Field: location = DirectiveLoc.Field; return(true); case NodeKind.FragmentDefinition: location = DirectiveLoc.FragmentDefinition; return(true); case NodeKind.FragmentSpread: location = DirectiveLoc.FragmentSpread; return(true); case NodeKind.InlineFragment: location = DirectiveLoc.InlineFragment; return(true); case NodeKind.VariableDefinition: location = DirectiveLoc.VariableDefinition; return(true); case NodeKind.OperationDefinition: switch (((OperationDefinitionNode)node).Operation) { case OperationType.Query: location = Types.DirectiveLocation.Query; return(true); case OperationType.Mutation: location = Types.DirectiveLocation.Mutation; return(true); case OperationType.Subscription: location = Types.DirectiveLocation.Subscription; return(true); default: location = default; return(false); } default: location = default; return(false); } }
public static ISchemaBuilder AddDirectiveType( this ISchemaBuilder builder, string name, DirectiveLocation location) => AddDirectiveType(builder, name, location, x => x);
public static void RegisterDirective( this ISchemaConfiguration context, string name, DirectiveLocation location) => RegisterDirective(context, name, location, x => x);