AzureExtensions.Swashbuckle icon indicating copy to clipboard operation
AzureExtensions.Swashbuckle copied to clipboard

Use `Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataProvider` instead to enable built-in Mvc model validation

Open nazar-kuzo opened this issue 3 years ago • 0 comments

Hey, Im working on built-in Mvc model validation with IObjectModelValidator` and it was not working due to service override in this line. https://github.com/vitalybibikov/AzureExtensions.Swashbuckle/blob/237b19b61100f59d1a8f60066f94c102fe5eebe1/src/AzureFunctions.Extensions.Swashbuckle/AzureFunctions.Extensions.Swashbuckle/SwashBuckleStartupExtension.cs#L49

It would be great if you could replace it to DefaultModelMetadataProvider instead, so it wont override default Mvc services after calling AddMvcCore().

Also I would encourage you to call TryAddSingleton instead since it is a Mvc framework service and it could be registered already.

Thanks!

nazar-kuzo avatar Aug 25 '21 15:08 nazar-kuzo