I received the following error after upgraded HotChocolate GraphQL from v12 to v13 for schema testing.
HotChocolate.SchemaException : For more details look at the Errors property.
Unable to infer or resolve a schema type from the type reference @AuthorizeDirective. It was working in HotChocolate v12, but failed after the upgraded to v13.
[ExtendObjectType(typeof(Query))]
public class PackageQueries
{
[UseResponseHeader]
[HotChocolate.Authorization.Authorize(Roles = new string[] { "User_Read" })]
public async Task<List<Package>?> GetPackages(
[Service] IMyService _MyService
string packageID,
CancellationToken cancellationToken)
And the schema test code
ISchema schema = await new ServiceCollection()
.AddGraphQL()
.AddQueryType<Query>()
.AddTypeExtension<PackageQueries>()
.AddTypeExtension<VersionQueries>()
.BuildSchemaAsync();
Any idea?
I have tried by AddType<HotChocolate.Authorization.Authorize>(), no success.