Describe the bug
public class SomeType: ObjectTypeExtension<Mutation>
{
protected override void Configure(IObjectTypeDescriptor<Mutation> descriptor)
{
base.Configure(descriptor);
descriptor.Include<SomeClass>().Authorize();
}
}
Authorizes all mutations from Mutation class (probably on the same level as authorized ones) in 11.0.0-preview.85
Expected behavior
Authorizes mutations only from SomeClass
hi @marcin-janiak
The IObjectTypeDescriptor is fluently implemented.
When you call descriptor.Include<SomeClass>().Authorize() then it is equivalent to
descriptor.Include<SomeClass>();
descriptor.Authorize();
So it is applied on the descriptor of the whole type.
ObjectTypeExtension Extend a type. These extensions end up in the same type.
So when you authorize one descriptor you actually authorize all.
How does SomeClass look like?
I think we can solve this problem in a different way :)
Also, have you considered to use the newer ObjectTypeExtension instead of Include?
The newer type extension API gives you more control and lets you completely decouple types.
Well, I understand how it works underneath but I have concerns about the experience of using it.
It just feels weird for me.
I noticed this during an intermediate step, then I've moved the resolvers to something like MeType which was actually my final goal.
Thanks.
@marcin-janiak Include is really on the way out .... we will depricate it with 11 since we have a much better API now to split types. With the type extensions the experience is better.