protected override void Configure( IObjectTypeDescriptor <Person> descriptor) { descriptor.Directive(new Resolve()); descriptor.Directive(new ADirective { Append = "Foo" }); descriptor.Field(t => t.Name) .Directive(new BDirective { Append = "Bar" }); }
public static IObjectTypeDescriptor <T> Authorize <T>( this IObjectTypeDescriptor <T> descriptor) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } return(descriptor.Directive(new AuthorizeDirective())); }
public static IObjectTypeDescriptor Authorize( this IObjectTypeDescriptor self) { if (self == null) { throw new ArgumentNullException(nameof(self)); } return(self.Directive(new AuthorizeDirective())); }
public static IObjectTypeDescriptor Authorize( this IObjectTypeDescriptor descriptor, params string[] roles) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } return(descriptor.Directive(new AuthorizeDirective(roles))); }
public static IObjectTypeDescriptor <T> Authorize <T>( this IObjectTypeDescriptor <T> descriptor, ApplyPolicy apply = ApplyPolicy.BeforeResolver) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } return(descriptor.Directive(new AuthorizeDirective(apply: apply))); }
public static IObjectTypeDescriptor <T> Authorize <T>( this IObjectTypeDescriptor <T> self, string policy) { if (self == null) { throw new ArgumentNullException(nameof(self)); } return(self.Directive(new AuthorizeDirective(policy))); }
public static IObjectTypeDescriptor Authorize( this IObjectTypeDescriptor self, string policy, params string[] roles) { if (self == null) { throw new ArgumentNullException(nameof(self)); } return(self.Directive(new AuthorizeDirective(policy, roles))); }
/// <summary> /// Adds the @key directive which is used to indicate a combination of fields that /// can be used to uniquely identify and fetch an object or interface. /// <example> /// type Product @key(fields: "upc") { /// upc: UPC! /// name: String /// } /// </example> /// </summary> /// <param name="descriptor"> /// The object type descriptor on which this directive shall be annotated. /// </param> /// <param name="fieldSet"> /// The field set that describes the key. /// Grammatically, a field set is a selection set minus the braces. /// </param> /// <returns></returns> /// <exception cref="ArgumentNullException"> /// <paramref name="descriptor"/> is <c>null</c>. /// </exception> /// <exception cref="ArgumentException"> /// <paramref name="fieldSet"/> is <c>null</c> or <see cref="string.Empty"/>. /// </exception> public static IObjectTypeDescriptor Key( this IObjectTypeDescriptor descriptor, string fieldSet) { if (descriptor is null) { throw new ArgumentNullException(nameof(descriptor)); } if (string.IsNullOrEmpty(fieldSet)) { throw new ArgumentException( FieldDescriptorExtensions_Key_FieldSet_CannotBeNullOrEmpty, nameof(fieldSet)); } return(descriptor.Directive( WellKnownTypeNames.Key, new ArgumentNode( WellKnownArgumentNames.Fields, new StringValueNode(fieldSet)))); }
protected override void Configure( IObjectTypeDescriptor <Query> descriptor) { descriptor.Directive("executeValidation"); descriptor.Field(t => t.SayHello(default))