public void DeclareDescription() { // arrange var descriptor = new DirectiveTypeDescriptor(); // act IDirectiveTypeDescriptor desc = descriptor; desc.Name("Foo"); desc.Description("Desc"); // assert Assert.Equal("Desc", descriptor.CreateDescription().Description); }
protected override void Configure(IDirectiveTypeDescriptor descriptor) { descriptor.Name("skip"); descriptor.Description( "Directs the executor to skip this field or " + "fragment when the `if` argument is true."); descriptor .Location(DirectiveLocation.Field | DirectiveLocation.FragmentSpread) .Location(DirectiveLocation.InlineFragment); descriptor.Argument("if") .Description("Skipped when true.") .Type <NonNullType <BooleanType> >(); }
protected override void Configure(IDirectiveTypeDescriptor descriptor) { descriptor.Name(WellKnownDirectives.Include); descriptor.Description( "Directs the executor to include this field or fragment " + "only when the `if` argument is true."); descriptor.Location(DirectiveLocation.Field) .Location(DirectiveLocation.FragmentSpread) .Location(DirectiveLocation.InlineFragment); descriptor.Argument(WellKnownDirectives.IfArgument) .Description("Included when true.") .Type <NonNullType <BooleanType> >(); }
protected override void Configure(IDirectiveTypeDescriptor descriptor) { descriptor.Name("upper"); descriptor.Description("Upper case letters"); descriptor.Location(DirectiveLocation.Field); descriptor.Location(DirectiveLocation.FragmentSpread); descriptor.Location(DirectiveLocation.InlineFragment); descriptor.Use(next => async context => { await next.Invoke(context); if (context.Result is string s) { context.Result = s.ToUpper(); } }); }
protected override void Configure( IDirectiveTypeDescriptor <CostDirective> descriptor) { descriptor.Name("cost"); descriptor.Description( "The cost directives is used to express the complexity " + "of a field."); descriptor.Location(DirectiveLocation.FieldDefinition); descriptor.Argument(t => t.Complexity) .Name("complexity") .Description("Defines the complexity of the field.") .Type <NonNullType <IntType> >() .DefaultValue(1); descriptor.Argument(t => t.Multipliers) .Name("multipliers") .Description( "Defines field arguments that act as " + "complexity multipliers.") .Type <ListType <NonNullType <MultiplierPathType> > >(); }