LSL.Swashbuckle.AspNetCore 1.0.4

dotnet add package LSL.Swashbuckle.AspNetCore --version 1.0.4                
NuGet\Install-Package LSL.Swashbuckle.AspNetCore -Version 1.0.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LSL.Swashbuckle.AspNetCore" Version="1.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LSL.Swashbuckle.AspNetCore --version 1.0.4                
#r "nuget: LSL.Swashbuckle.AspNetCore, 1.0.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LSL.Swashbuckle.AspNetCore as a Cake Addin
#addin nuget:?package=LSL.Swashbuckle.AspNetCore&version=1.0.4

// Install LSL.Swashbuckle.AspNetCore as a Cake Tool
#tool nuget:?package=LSL.Swashbuckle.AspNetCore&version=1.0.4                

Build status Coveralls branch NuGet

LSL.Swashbuckle.AspNetCore

This package provides extensions to Swashbuckle.AspNetCore and Asp.Versioning.Mvc.ApiExplorer to provide a quicker route to implement versioning in an API.

Quick Start

The following code shows the setting up of an API to use all of the provided extensions:

using LSL.Swahbuckle.AspNetCore
...
// Within ConfigureServices

// Adds the information found in "Program"'s assembly's AssemblyInformationalVersionAttribute to generated OpenApi documents
// this is then found under the "x-code-version" property under the standard "info" property in the OpenApi document
// Properties of "x-code-version":
//  "version": the assembly version
// "commitHash": the githash if found in the AssemblyInformationalVersionAttribute,
// "commitUrl": only setup if a call is made to add the commit hash url (the following sets up a URL for Azure devops)
//      This is optional but when applied then any call to AddCodeVersionToApiDescription
//      will add a link to the version number to the commit
//      Other methods to setup the url are included for GitHub And BitBucket:
//          AddUrlForGitHubCommit
//          AddUrlForBitBucketCommit
services.AddCodeVersionForAssemblyOf<Program>(c => c.AddUrlForDevopsGitCommit("MyOrg", "MyProject", "MyRepo"))
    // Ensures all versions of the API are available in swagger UI
    .AddSwaggerGenWithVersioning(c =>
    {
        // Shows the code version in the Swagger UI description
        c.AddCodeVersionToApiDescription()
            // Picks up the xml comments for the assembly of the provided class (Program in this case)
            .AddXmlCommentsForAssemblyOf<Program>()
            // Adds a schema filter to automatically convert enums to strings
            .AddStringEnumFilter()
            // Populates the OpenApi documents with a list of server Urls (just one picked up here from the API's configuration)
            .WithServerUrls(new[] { builder.Configuration.GetValue<string>("SwaggerServerUrl")! })
            // Sets up the Swagger UI title (shown in the UI - not the html title) from the assembly name
            // of the provided class
            .WithTitleFromAssemblyOf<Program>();
    },
    // Allows for further configuration of the ApiVersioningOptions
    apiVersioningConfigurator: o => { }
    // Allows for further configuration of the ApiExplorerOptions
    // Default Version number format is "VVV" and a groupNameFormat of "'v'VVV"
    apiExplorerConfigurator: o => o.WithVersionNumberFormat("VV"));

...

var app = builder.Build();


// Enables swagger UI with versioning
app.UseSwaggerUIWithVersioning(c => 
{
    // Sets the html document title to "{assemblyName} - Swagger UI"
    c.AddDocumentTitleFromAssemblyOf<Program>();
});
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 99 8/31/2024
1.0.3 91 8/31/2024
1.0.2 100 5/21/2024
1.0.1 92 5/10/2024