yuka1984 / azure-functions-extensions-swashbuckle

MIT License
33 stars 29 forks source link

Added ability to configure options from extension method. #39

Open colinbull opened 4 years ago

colinbull commented 4 years ago

@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:

  1. Incorrect swagger base route. #38
  2. Ability to configure OpenAPI spec writer #35
  3. Display Examples #30

image

  1. Support for .NET Core 3 and functions v3 #29 #21
miszu commented 4 years ago

It'd be great to get it merged, what do you think @yuka1984?

rbev commented 4 years ago

This would be great

tommy-grovnes commented 4 years ago

It'd be great to get it merged, what do you think @yuka1984?