< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Hosting.Options.OpenApiMapRouteOptions
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Hosting/Options/OpenApiMapRouteOptions.cs
Tag: Kestrun/Kestrun@ca54e35c77799b76774b3805b6f075cdbc0c5fbe
Line coverage
0%
Covered lines: 0
Uncovered lines: 20
Coverable lines: 20
Total lines: 82
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 12/12/2025 - 17:27:19 Line coverage: 0% (0/14) Branch coverage: 0% (0/2) Total lines: 56 Tag: Kestrun/Kestrun@826bf9dcf9db118c5de4c78a3259bce9549f0dcd12/26/2025 - 18:43:06 Line coverage: 0% (0/20) Branch coverage: 0% (0/6) Total lines: 82 Tag: Kestrun/Kestrun@66a9a3a4461391825b9a1ffc8190f76adb1bb67f 12/12/2025 - 17:27:19 Line coverage: 0% (0/14) Branch coverage: 0% (0/2) Total lines: 56 Tag: Kestrun/Kestrun@826bf9dcf9db118c5de4c78a3259bce9549f0dcd12/26/2025 - 18:43:06 Line coverage: 0% (0/20) Branch coverage: 0% (0/6) Total lines: 82 Tag: Kestrun/Kestrun@66a9a3a4461391825b9a1ffc8190f76adb1bb67f

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)0%620%
get_SpecVersion()100%210%
get_VersionVarName()100%210%
get_FormatVarName()100%210%
get_RefreshVarName()100%210%
get_DefaultFormat()100%210%
get_DefaultVersion()100%210%
get_DocId()100%210%
set_DocId(...)0%2040%
get_MapOptions()100%210%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Hosting/Options/OpenApiMapRouteOptions.cs

#LineLine coverage
 1using Kestrun.OpenApi;
 2using Microsoft.OpenApi;
 3
 4namespace Kestrun.Hosting.Options;
 5
 6/// <summary>
 7/// Options for OpenAPI map route.
 8/// </summary>
 9public record OpenApiMapRouteOptions
 10{
 11    /// <summary>
 12    /// Constructor for OpenApiMapRouteOptions.
 13    /// </summary>
 14    /// <param name="mapOptions"></param>
 015    public OpenApiMapRouteOptions(MapRouteOptions mapOptions)
 16    {
 017        MapOptions = mapOptions;
 018        if (MapOptions.Pattern == null)
 19        {
 20            //MapOptions.Pattern = "/openapi/{version:regex(^v(2\\.0|3\\.0(\\.\\d+)?|3\\.1(\\.\\d+)?)$)}/{file:regex(^([
 021            MapOptions.Pattern = "/openapi/{version}/openapi.{format}";
 22        }
 023        _documentId = OpenApiDocDescriptor.DefaultDocumentationId;
 024    }
 25
 26    /// <summary>
 27    /// The supported OpenAPI spec versions.
 28    /// </summary>
 029    public OpenApiSpecVersion[] SpecVersion { get; set; } =
 030      [OpenApiSpecVersion.OpenApi2_0, OpenApiSpecVersion.OpenApi3_0, OpenApiSpecVersion.OpenApi3_1, OpenApiSpecVersion.O
 31
 32    /// <summary>
 33    /// The name of the route variable for version.
 34    /// </summary>
 035    public string VersionVarName { get; set; } = "version";
 36
 37    /// <summary>
 38    /// The name of the route variable for format.
 39    /// </summary>
 040    public string FormatVarName { get; set; } = "format";
 41
 42    /// <summary>
 43    /// The name of the query variable for refresh.
 44    /// </summary>
 045    public string RefreshVarName { get; set; } = "refresh";
 46
 47    /// <summary>
 48    /// The default format to use if not specified in the route.
 49    /// </summary>
 050    public string DefaultFormat { get; set; } = "json";
 51
 52    /// <summary>
 53    /// The default version to use if not specified in the route.
 54    /// </summary>
 055    public string DefaultVersion { get; set; } = "v3.0";
 56
 57    /// <summary>
 58    /// The document ID to serve.
 59    /// </summary>
 60    private string _documentId;
 61
 62    /// <summary>
 63    /// The document ID to serve.
 64    /// </summary>
 65    public string DocId
 66    {
 067        get => _documentId;
 68        set
 69        {
 070            _documentId = value;
 071            if (value != OpenApiDocDescriptor.DefaultDocumentationId &&
 072                MapOptions.Pattern == "/openapi/{version}/openapi.{format}")
 73            {
 074                MapOptions.Pattern = "/openapi/{documentId}/{version}/openapi.{format}";
 75            }
 076        }
 77    }
 78    /// <summary>
 79    /// The map route options.
 80    /// </summary>
 081    public MapRouteOptions MapOptions { get; set; }
 82}