< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.OpenApi.OpenApiComponentKindExtensions
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/OpenApi/OpenApiComponentKind.cs
Tag: Kestrun/Kestrun@ca54e35c77799b76774b3805b6f075cdbc0c5fbe
Line coverage
95%
Covered lines: 23
Uncovered lines: 1
Coverable lines: 24
Total lines: 119
Line coverage: 95.8%
Branch coverage
95%
Covered branches: 21
Total branches: 22
Branch coverage: 95.4%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 12/23/2025 - 19:23:04 Line coverage: 0% (0/24) Branch coverage: 0% (0/22) Total lines: 119 Tag: Kestrun/Kestrun@d062f281460e6c123c372aef61f8d957bbb6c90101/08/2026 - 08:19:25 Line coverage: 95.8% (23/24) Branch coverage: 95.4% (21/22) Total lines: 119 Tag: Kestrun/Kestrun@6ab94ca7560634c2ac58b36c2b98e2a9b1bf305d 12/23/2025 - 19:23:04 Line coverage: 0% (0/24) Branch coverage: 0% (0/22) Total lines: 119 Tag: Kestrun/Kestrun@d062f281460e6c123c372aef61f8d957bbb6c90101/08/2026 - 08:19:25 Line coverage: 95.8% (23/24) Branch coverage: 95.4% (21/22) Total lines: 119 Tag: Kestrun/Kestrun@6ab94ca7560634c2ac58b36c2b98e2a9b1bf305d

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
ToInlineLabel(...)91.66%121293.33%
SupportsInline(...)100%1010100%

File(s)

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

#LineLine coverage
 1namespace Kestrun.OpenApi;
 2
 3/// <summary>
 4/// Represents the fixed component buckets defined by the OpenAPI 3.2 specification
 5/// under the <c>components</c> object.
 6/// </summary>
 7/// <remarks>
 8/// This enum mirrors the OpenAPI 3.2 Components Object exactly.
 9/// It is intended for dispatch, existence checks, retrieval, and removal logic
 10/// over <see cref="Microsoft.OpenApi.OpenApiComponents"/>.
 11/// </remarks>
 12public enum OpenApiComponentKind
 13{
 14    /// <summary>
 15    /// Reusable schema definitions for request and response payloads.
 16    /// Maps to <c>components/schemas</c>.
 17    /// </summary>
 18    Schemas,
 19
 20    /// <summary>
 21    /// Reusable response definitions.
 22    /// Maps to <c>components/responses</c>.
 23    /// </summary>
 24    Responses,
 25
 26    /// <summary>
 27    /// Reusable parameter definitions (query, header, path, cookie).
 28    /// Maps to <c>components/parameters</c>.
 29    /// </summary>
 30    Parameters,
 31
 32    /// <summary>
 33    /// Reusable example definitions.
 34    /// Maps to <c>components/examples</c>.
 35    /// </summary>
 36    Examples,
 37
 38    /// <summary>
 39    /// Reusable request body definitions.
 40    /// Maps to <c>components/requestBodies</c>.
 41    /// </summary>
 42    RequestBodies,
 43
 44    /// <summary>
 45    /// Reusable header definitions.
 46    /// Maps to <c>components/headers</c>.
 47    /// </summary>
 48    Headers,
 49
 50    /// <summary>
 51    /// Reusable security scheme definitions (OAuth2, API key, HTTP auth, etc.).
 52    /// Maps to <c>components/securitySchemes</c>.
 53    /// </summary>
 54    SecuritySchemes,
 55
 56    /// <summary>
 57    /// Reusable link definitions describing relationships between operations.
 58    /// Maps to <c>components/links</c>.
 59    /// </summary>
 60    Links,
 61
 62    /// <summary>
 63    /// Reusable callback definitions for asynchronous or event-driven APIs.
 64    /// Maps to <c>components/callbacks</c>.
 65    /// </summary>
 66    Callbacks,
 67
 68    /// <summary>
 69    /// Reusable path item definitions.
 70    /// Maps to <c>components/pathItems</c>.
 71    /// </summary>
 72    PathItems,
 73
 74    /// <summary>
 75    /// Reusable media type definitions (introduced in OpenAPI 3.2).
 76    /// Maps to <c>components/mediaTypes</c>.
 77    /// </summary>
 78    MediaTypes
 79}
 80/// <summary>
 81/// Extension methods for <see cref="OpenApiComponentKind"/>.
 82/// </summary>
 83public static class OpenApiComponentKindExtensions
 84{
 85    /// <summary>
 86    /// Converts the component kind to its inline label form.
 87    /// </summary>
 88    /// <param name="kind"> The kind of OpenAPI component.</param>
 89    /// <returns>The inline label corresponding to the component kind.</returns>
 1390    public static string ToInlineLabel(this OpenApiComponentKind kind) => kind switch
 1391    {
 192        OpenApiComponentKind.Schemas => "schema",
 193        OpenApiComponentKind.Responses => "response",
 194        OpenApiComponentKind.Parameters => "parameter",
 295        OpenApiComponentKind.Examples => "example",
 196        OpenApiComponentKind.RequestBodies => "request body",
 197        OpenApiComponentKind.Headers => "header",
 198        OpenApiComponentKind.SecuritySchemes => "security scheme",
 299        OpenApiComponentKind.Links => "link",
 1100        OpenApiComponentKind.Callbacks => "callback",
 1101        OpenApiComponentKind.PathItems => "path item",
 1102        OpenApiComponentKind.MediaTypes => "media type",
 0103        _ => kind.ToString()
 13104    };
 105    /// <summary>
 106    /// Determines if the specified component kind supports inline definitions.
 107    /// </summary>
 108    /// <param name="kind">The kind of OpenAPI component.</param>
 109    /// <returns>True if the component kind supports inline definitions; otherwise, false.</returns>
 11110    public static bool SupportsInline(this OpenApiComponentKind kind) => kind switch
 11111    {
 1112        OpenApiComponentKind.Examples => true,
 1113        OpenApiComponentKind.Links => true,
 1114        OpenApiComponentKind.Parameters => true,
 1115        OpenApiComponentKind.Headers => true,
 1116        OpenApiComponentKind.MediaTypes => true,
 6117        _ => false
 11118    };
 119}