Is there an existing issue for this?
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
Is there an existing issue for this?
Product
Hot Chocolate
Describe the bug
When adding mutations via an ITypeModule you can register them using
UseMutationConventionbut if you callError<>()afterwards it will throw inObjectFieldDefinitionExtensions.cson line 52 due to theMutationContextDataKeys.Optionsnot being registered in the provided IDescriptorContext from the ITypeModule /or/ registered via a manual call toUseMutationConvention().Steps to reproduce
ObjectFieldDefinition newField = new(<stuff>).ToDescriptor(context).UseMutationConvention().Error<AnError>().ToDefinition()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):
Version
13.7.0