I'm using DataAnnotatedModelValidations package in my GraphQL application And i've shared a part of my program.cs
builder.Services
.AddGraphQLServer()
.AddDataAnnotationsValidator()
.
.
.
var app = builder.Build();
app.UseAuthentication();
app.UseAuthorization();
app.MapGraphQL("/");
My problem is every time I am executing a mutation a validation process has priority over authorization. So if I am executing a mutation with invalid input and without required permission the expected behavior would be to get an unauthorized error but i get the list of validation errors. When I validate my input and run again than I got unauthorized error.
Is there a solution to make authorization process to have priority? Without required permission, the API must return "user is not authorized...", even if the input is full of error.
Is there a solution?