azure-functions-extensions-swashbuckle
azure-functions-extensions-swashbuckle copied to clipboard
Added ability to configure options from extension method.
@yuka1984
The PR adds the ability to be able to configure the SwaggerGen
options and the Swashbuckle
options from the extension method call. It follows the same pattern as most of the .net core ecosystem, this I think fixes #15. For example:
public void Configure(IWebJobsBuilder builder)
{
//Register the extension
builder.AddSwashBuckle(Assembly.GetExecutingAssembly(), opts =>
{
opts.OpenApiSpec = OpenApiSpecVersion.OpenApi3_0;
opts.Documents = new OptionDocument[]
{
new OptionDocument { Description = "Custom Generated By Swashbuckle", Name = "v1", Title = "Test API", Version = "v1.1.10"},
};
opts.Title = "Hello";
opts.FillSwaggerBasePathWithRoutePrefix = false;
opts.SwaggerConfigurator = s =>
{
s.SchemaFilter<TestController.TypeExcludeFilter>(new TestController.TypeExcludeFilter.Options(typeof(IModelValidator)));
};
});
It also brings the Swagger packages and references up to the latest version. This was required due to some changes in Swagger moving to the OpenAPI spec
I have also fixed a few bugs:
- Incorrect swagger base route. #38
- Ability to configure OpenAPI spec writer #35
- Display Examples #30
- Support for .NET Core 3 and functions v3 #29 #21
It'd be great to get it merged, what do you think @yuka1984?
This would be great
It'd be great to get it merged, what do you think @yuka1984?