< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.OpenApi.OaParameterExtensions
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/OpenApi/OaParameterExtensions.cs
Tag: Kestrun/Kestrun@5f1d2b981c9d7292c11fd448428c6ab6c811c5de
Line coverage
100%
Covered lines: 46
Uncovered lines: 0
Coverable lines: 46
Total lines: 98
Line coverage: 100%
Branch coverage
100%
Covered branches: 36
Total branches: 36
Branch coverage: 100%
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: 8.6% (4/46) Branch coverage: 2.7% (1/36) Total lines: 98 Tag: Kestrun/Kestrun@826bf9dcf9db118c5de4c78a3259bce9549f0dcd12/25/2025 - 19:20:44 Line coverage: 0% (0/46) Branch coverage: 0% (0/36) Total lines: 98 Tag: Kestrun/Kestrun@5251f12f253e29f8a1dfb77edc2ef50b90a4f26f01/08/2026 - 02:20:28 Line coverage: 8.6% (4/46) Branch coverage: 2.7% (1/36) Total lines: 98 Tag: Kestrun/Kestrun@4bc17b7e465c315de6386907c417e44fcb0fd3eb03/26/2026 - 03:54:59 Line coverage: 100% (46/46) Branch coverage: 100% (36/36) Total lines: 98 Tag: Kestrun/Kestrun@844b5179fb0492dc6b1182bae3ff65fa7365521d 12/12/2025 - 17:27:19 Line coverage: 8.6% (4/46) Branch coverage: 2.7% (1/36) Total lines: 98 Tag: Kestrun/Kestrun@826bf9dcf9db118c5de4c78a3259bce9549f0dcd12/25/2025 - 19:20:44 Line coverage: 0% (0/46) Branch coverage: 0% (0/36) Total lines: 98 Tag: Kestrun/Kestrun@5251f12f253e29f8a1dfb77edc2ef50b90a4f26f01/08/2026 - 02:20:28 Line coverage: 8.6% (4/46) Branch coverage: 2.7% (1/36) Total lines: 98 Tag: Kestrun/Kestrun@4bc17b7e465c315de6386907c417e44fcb0fd3eb03/26/2026 - 03:54:59 Line coverage: 100% (46/46) Branch coverage: 100% (36/36) Total lines: 98 Tag: Kestrun/Kestrun@844b5179fb0492dc6b1182bae3ff65fa7365521d

Coverage delta

Coverage delta 98 -98

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
ToOpenApi(...)100%55100%
ToOpenApi(...)100%88100%
ToParameterLocation(...)100%55100%
ToParameterStyle(...)100%1010100%
ToOpenApiParameterLocation(...)100%88100%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/OpenApi/OaParameterExtensions.cs

#LineLine coverage
 1using Microsoft.OpenApi;
 2
 3namespace Kestrun.OpenApi;
 4
 5/// <summary>
 6/// Extensions for <see cref="OaParameterLocation"/>.
 7/// </summary>
 8public static class OaParameterExtensions
 9{
 10    /// <summary>Convert to Microsoft.OpenApi ParameterLocation.</summary>
 11    /// <param name="location">The OaParameterLocation value.</param>
 12    /// <returns>The corresponding ParameterLocation value.</returns>
 13    public static ParameterLocation ToOpenApi(this OaParameterLocation location)
 714        => location switch
 715        {
 316            OaParameterLocation.Query => ParameterLocation.Query,
 117            OaParameterLocation.Header => ParameterLocation.Header,
 118            OaParameterLocation.Path => ParameterLocation.Path,
 119            OaParameterLocation.Cookie => ParameterLocation.Cookie,
 120            _ => throw new ArgumentOutOfRangeException(nameof(location), location, null)
 721        };
 22
 23    /// <summary>
 24    /// Convert to Microsoft.OpenApi ParameterStyle.
 25    /// </summary>
 26    /// <param name="style"></param>
 27    /// <returns></returns>
 28    /// <exception cref="ArgumentOutOfRangeException"></exception>
 29    public static ParameterStyle ToOpenApi(this OaParameterStyle style)
 830        => style switch
 831        {
 132            OaParameterStyle.Simple => ParameterStyle.Simple,
 133            OaParameterStyle.Form => ParameterStyle.Form,
 134            OaParameterStyle.Matrix => ParameterStyle.Matrix,
 135            OaParameterStyle.Label => ParameterStyle.Label,
 136            OaParameterStyle.SpaceDelimited => ParameterStyle.SpaceDelimited,
 137            OaParameterStyle.PipeDelimited => ParameterStyle.PipeDelimited,
 138            OaParameterStyle.DeepObject => ParameterStyle.DeepObject,
 139            _ => throw new ArgumentOutOfRangeException(nameof(style), style, null)
 840        };
 41
 42    /// <summary>
 43    /// Convert to Microsoft.OpenApi ParameterLocation.
 44    /// </summary>
 45    /// <param name="location">The OaParameterLocation value.</param>
 46    /// <returns>The corresponding ParameterLocation value.</returns>
 47    /// <exception cref="ArgumentOutOfRangeException">Thrown when the location is not recognized.</exception>
 48    public static ParameterLocation ToParameterLocation(this OaParameterLocation location)
 49    {
 550        return location switch
 551        {
 152            OaParameterLocation.Query => ParameterLocation.Query,
 153            OaParameterLocation.Header => ParameterLocation.Header,
 154            OaParameterLocation.Path => ParameterLocation.Path,
 155            OaParameterLocation.Cookie => ParameterLocation.Cookie,
 156            _ => throw new ArgumentOutOfRangeException(nameof(location), location, null)
 557        };
 58    }
 59
 60    /// <summary>
 61    /// Convert to Microsoft.OpenApi ParameterStyle.
 62    /// </summary>
 63    /// <param name="style">The OaParameterStyle value.</param>
 64    /// <returns>The corresponding ParameterStyle value.</returns>
 65    /// <exception cref="ArgumentOutOfRangeException">Thrown when the style is not recognized.</exception>
 66    public static ParameterStyle ToParameterStyle(this OaParameterStyle? style)
 67    {
 868        return style switch
 869        {
 170            OaParameterStyle.Simple => ParameterStyle.Simple,
 171            OaParameterStyle.Form => ParameterStyle.Form,
 172            OaParameterStyle.Matrix => ParameterStyle.Matrix,
 173            OaParameterStyle.Label => ParameterStyle.Label,
 174            OaParameterStyle.SpaceDelimited => ParameterStyle.SpaceDelimited,
 175            OaParameterStyle.PipeDelimited => ParameterStyle.PipeDelimited,
 176            OaParameterStyle.DeepObject => ParameterStyle.DeepObject,
 177            _ => throw new ArgumentOutOfRangeException(nameof(style), style, null)
 878        };
 79    }
 80
 81    /// <summary>
 82    /// Convert string to Microsoft.OpenApi ParameterLocation.
 83    /// </summary>
 84    /// <param name="location">The string representation of the parameter location.</param>
 85    /// <returns>The corresponding OpenApi ParameterLocation value.</returns>
 86    /// <exception cref="ArgumentOutOfRangeException">Thrown when the location is not recognized.</exception>
 87    public static ParameterLocation ToOpenApiParameterLocation(this string location)
 88    {
 589        return location.ToLower() switch
 590        {
 191            "query" => ParameterLocation.Query,
 192            "header" => ParameterLocation.Header,
 193            "path" => ParameterLocation.Path,
 194            "cookie" => ParameterLocation.Cookie,
 195            _ => throw new ArgumentOutOfRangeException(nameof(location), location, null)
 596        };
 97    }
 98}