We have a .NET Core 3.1 web app and use Newtonsoft JSON.NET serializer there registered for serializing/deserializing. But now we got stupid client who send us invalid JSON which contain fields which we don't have in our models. It's normal for JSON to ignore them, but I need to find way to create model state errors when deserializer finds invalid fields.
We have problem with optional fields so default validation won't help here.
based on this doc try something like this
error handler:
args.ErrorContext.Handled = {true/false};