Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Product
Hot Chocolate
Describe the bug
When adding mutations via an ITypeModule you can register them using UseMutationConvention
but if you call Error<>()
afterwards it will throw in ObjectFieldDefinitionExtensions.cs
on line 52 due to the MutationContextDataKeys.Options
not being registered in the provided IDescriptorContext from the ITypeModule /or/ registered via a manual call to UseMutationConvention()
.
Steps to reproduce
- Create a ITypeModule
- Add a mutation method
ObjectFieldDefinition newField = new(<stuff>).ToDescriptor(context).UseMutationConvention().Error<AnError>().ToDefinition()
- Fails
Relevant log output
No response
Additional Context?
This can be worked around by adding this to the top of the registration function (fixes the broken AddError lookup):
context.ContextData["HotChocolate.Types.Mutations.Options"] = new HotChocolate.Types.MutationConventionOptions
{
ApplyToAllMutations = true,
};
Version
13.7.0