vitalybibikov / AzureExtensions.Swashbuckle

This extension enriches Azure Functions with Swagger/ Open API support
https://www.linkedin.com/in/vitali-bibikov/
MIT License
67 stars 54 forks source link

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

Closed nazar-kuzo closed 6 months ago

nazar-kuzo commented 3 years ago

Hey, Im working on built-in Mvc model validation withIObjectModelValidator` 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!

vitalybibikov commented 6 months ago

Closing this, as not relevant, please reopen if needed