< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Hosting.Options.MapRouteOptions
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Hosting/Options/MapRouteOptions.cs
Tag: Kestrun/Kestrun@9d3a582b2d63930269564a7591aa77ef297cadeb
Line coverage
100%
Covered lines: 22
Uncovered lines: 0
Coverable lines: 22
Total lines: 110
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Pattern()100%11100%
get_HttpVerbs()100%11100%
get_Code()100%11100%
get_Language()100%11100%
get_ExtraImports()100%11100%
get_ExtraRefs()100%11100%
get_RequireSchemes()100%11100%
get_RequirePolicies()100%11100%
get_CorsPolicyName()100%11100%
get_ShortCircuit()100%11100%
get_ShortCircuitStatusCode()100%11100%
get_AllowAnonymous()100%11100%
get_DisableAntiforgery()100%11100%
get_RateLimitPolicyName()100%11100%
get_Arguments()100%11100%
get_Summary()100%11100%
get_Description()100%11100%
get_OperationId()100%11100%
get_Tags()100%11100%
get_GroupName()100%11100%
get_OpenAPI()100%11100%
get_ThrowOnDuplicate()100%11100%

File(s)

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

#LineLine coverage
 1
 2using System.Reflection;
 3using Kestrun.Scripting;
 4using Kestrun.Utilities;
 5
 6namespace Kestrun.Hosting.Options;
 7/// <summary>
 8/// Options for mapping a route, including pattern, HTTP verbs, script code, authorization, and metadata.
 9/// </summary>
 10public record MapRouteOptions
 11{
 12    /// <summary>
 13    /// The route pattern to match for this option.
 14    /// </summary>
 15415    public string? Pattern { get; set; }
 16    /// <summary>
 17    /// The HTTP verbs (methods) that this route responds to.
 18    /// </summary>
 10519    public List<HttpVerb> HttpVerbs { get; set; } = [];
 20    /// <summary>
 21    /// The script code to execute for this route.
 22    /// </summary>
 3523    public string? Code { get; set; }
 24    /// <summary>
 25    /// The scripting language used for the route's code.
 26    /// </summary>
 6827    public ScriptLanguage Language { get; set; } = ScriptLanguage.PowerShell;
 28    /// <summary>
 29    /// Additional import namespaces required for the script code.
 30    /// </summary>
 1131    public string[]? ExtraImports { get; set; }
 32    /// <summary>
 33    /// Additional assembly references required for the script code.
 34    /// </summary>
 1135    public Assembly[]? ExtraRefs { get; set; }
 36    /// <summary>
 37    /// Authorization Scheme names required for this route.
 38    /// </summary>
 3839    public string[] RequireSchemes { get; set; } = []; // Authorization scheme name, if any
 40    /// <summary>
 41    /// Authorization policy names required for this route.
 42    /// </summary>
 3343    public string[]? RequirePolicies { get; set; } = []; // Authorization policies, if any
 44    /// <summary>
 45    /// Name of the CORS policy to apply, if any.
 46    /// </summary>
 2747    public string CorsPolicyName { get; set; } = string.Empty; // Name of the CORS policy to apply, if any
 48    /// <summary>
 49    /// If true, short-circuits the pipeline after this route.
 50    /// </summary>
 1351    public bool ShortCircuit { get; set; } // If true, short-circuit the pipeline after this route
 52    /// <summary>
 53    /// Status code to return if short-circuiting the pipeline after this route.
 54    /// </summary>
 155    public int? ShortCircuitStatusCode { get; set; } = null; // Status code to return if short-circuiting
 56    /// <summary>
 57    /// If true, allows anonymous access to this route.
 58    /// </summary>
 1359    public bool AllowAnonymous { get; set; }
 60    /// <summary>
 61    /// If true, disables antiforgery protection for this route.
 62    /// </summary>
 1363    public bool DisableAntiforgery { get; set; }
 64    /// <summary>
 65    /// The name of the rate limit policy to apply to this route, if any.
 66    /// </summary>
 1367    public string? RateLimitPolicyName { get; set; }
 68
 69    /// <summary>
 70    /// Additional metadata for the route, represented as key-value pairs.
 71    /// </summary>
 2872    public Dictionary<string, object?>? Arguments { get; set; } = []; // Additional metadata for the route
 73
 74    /// <summary>
 75    /// Metadata for OpenAPI documentation related to the route.
 76    /// </summary>
 77    public record OpenAPIMetadata
 78    {
 79        /// <summary>
 80        /// A brief summary of the route for OpenAPI documentation.
 81        /// </summary>
 1182        public string? Summary { get; set; }
 83        /// <summary>
 84        /// A detailed description of the route for OpenAPI documentation.
 85        /// </summary>
 1186        public string? Description { get; set; }
 87        /// <summary>
 88        /// The unique operation ID for the route in OpenAPI documentation.
 89        /// </summary>
 1190        public string? OperationId { get; set; }
 91        /// <summary>
 92        /// Comma-separated tags for OpenAPI documentation.
 93        /// </summary>
 2794        public string[] Tags { get; set; } = []; // Comma-separated tags
 95        /// <summary>
 96        /// Group name for OpenAPI documentation.
 97        /// </summary>
 1198        public string? GroupName { get; set; } // Group name for OpenAPI documentation
 99    }
 100
 101    /// <summary>
 102    /// OpenAPI metadata for this route.
 103    /// </summary>
 67104    public OpenAPIMetadata OpenAPI { get; set; } = new OpenAPIMetadata(); // OpenAPI metadata for this route
 105
 106    /// <summary>
 107    /// If true, throws an exception on duplicate routes.
 108    /// </summary>
 5109    public bool ThrowOnDuplicate { get; set; }
 110}