1

Imagine this ObjectType with field "bars" from FooResolver annotated with BazDirective

    public class FooResolver {
       public IEnumerable<Bar> GetBars(string name) {/*omitted*/}
    }
    
    public class FooType: ObjectType<Foo>
    {

        protected override void Configure(IObjectTypeDescriptor<Foo> descriptor) {
            descriptor.Field<FooResolver>(_ => _.GetBars(default)).Directive<BazDirective>();
        } 
    } 

If we instead use extension binding

class FooType: ObjectType<Foo> {}

[ExtendObjectType(Name="Foo")]
class FooResolver {
   [/* how to bind BazDirective? */]
   public IEnumerable<Bar> GetBars(string name) {/* omitted */}
}
   

How to bind BazDirective?

1 Answers1

0

The solution is using custom DescriptorAttributes that can be used to add extra information on the field.

https://github.com/ChilliCream/hotchocolate-docs/blob/master/docs/descriptor-attributes.md