Skip to content

Fast.Swagger ​

Public members, parameters, returns, and exceptions

Reference source version 3.5.41; targets: net8.0;net9.0;net10.0.

When upgrading code that uses platform flags, see the Runtime H5 migration guide and the dependency history.

The preceding 3.5.38 batch updated centrally managed Swashbuckle.AspNetCore from 10.3.0 to 10.3.1; this 3.5.41 dependency-alignment batch retains 10.3.1.

Contract and constraints ​

Swagger JSON, grouping and UI integration. AddSwaggerDocuments() defaults to SwaggerSettings. Configuration-section registration applies PostConfigure, whereas the callback overload does not automatically do so. UseSwaggerDocuments() enables middleware according to Enable. Defaults include Enable=true, DocumentTitle="Specification Api Document", DefaultGroupName="Default", FormatAsV2=false and RouteTemplate="swagger/{documentName}/swagger.json". An unset RoutePrefix places the UI at the site root. EnableAuthorized configures documentation security definitions; it does not secure access to the documentation. SwaggerDocumentBuilder grouping APIs depend on initialized MVC descriptions. SchemaIdAttribute and OperationIdAttribute control generated identifiers. Response metadata documents a contract but does not verify the runtime actually returns that response.

Installation and examples ​

Install the package ​

The Fast.NET getting started example is verified with 3.5.37.

bash
dotnet add package Fast.Swagger

Example 1 ​

csharp
using Fast.Swagger;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddSwaggerDocuments(builder.Configuration);
var app = builder.Build();
app.UseSwaggerDocuments();
app.MapControllers();
app.Run();

Example 2 ​

csharp
using Microsoft.AspNetCore.Mvc;

[ApiController]
[Route("api/catalog")]
public sealed class CatalogController : ControllerBase
{
    [HttpGet("{id:int}")]
    [ProducesResponseType(typeof(CatalogItem), 200)]
    public ActionResult<CatalogItem> Get(int id) => new CatalogItem(id, "示例商品");
}

public sealed record CatalogItem(int Id, string Name);

Web-host examples belong in a consumer project using Microsoft.NET.Sdk.Web and a supported .NET target. IaaS examples can be used in an ordinary class library. Registration precedes builder.Build(); configure middleware and endpoints before app.Run(). Samples retain their original code and comments. No host, external service, database operation or client generator was run, and these snippets have not been compiled in this update.

Source reference ​

Dependency alignment on 2026-11-02 ​

2026-11-02 dependency alignment: this package increments from 3.5.40 to 3.5.41, updating its dependency to Fast.Runtime 3.5.37, also aligning Fast.DynamicApplication 3.5.42. This module's implementation and public declarations are unchanged. Runtime adds mobile H5 and shifts Android and subsequent flags; migrate numeric protocols/masks, rebuild consumers and regenerate client enums. See the Runtime H5 migration guide.

2026-10-24 versions and dependencies ​

On 2026-10-24, this package increments from 3.5.37 to 3.5.38, with dependencies updated to Fast.Runtime 3.5.34 / Fast.DynamicApplication 3.5.39. This module's own implementation and public declarations are unchanged.

Swashbuckle.AspNetCore updates from 10.3.0 to 10.3.1. Swagger JSON/UI runtime behavior was not verified in this batch.

Consumers using AppEnvironmentEnum must migrate numeric values and rebuild according to the Runtime HarmonyOS migration guide. This batch reviewed source and effective MSBuild package metadata only. Tests were skipped as requested; no restore, build, pack or consumer runtime validation was performed.