< Summary - Kestrun — Combined Coverage

Information
Class: Public.OpenAPI.New-KrOpenApiServer
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/OpenAPI/New-KrOpenApiServer.ps1
Tag: Kestrun/Kestrun@0d738bf294e6281b936d031e1979d928007495ff
Line coverage
0%
Covered lines: 0
Uncovered lines: 10
Coverable lines: 10
Total lines: 42
Line coverage: 0%
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 12/12/2025 - 17:27:19 Line coverage: 0% (0/10) Total lines: 42 Tag: Kestrun/Kestrun@826bf9dcf9db118c5de4c78a3259bce9549f0dcd

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/OpenAPI/New-KrOpenApiServer.ps1

#LineLine coverage
 1<#
 2.SYNOPSIS
 3    Creates a new OpenAPI server.
 4.DESCRIPTION
 5    This function creates a new OpenAPI server using the provided parameters.
 6.PARAMETER Description
 7    A description of the server.
 8.PARAMETER Url
 9    The URL of the server.
 10.PARAMETER Variables
 11    A dictionary of server variables.
 12.EXAMPLE
 13    $variables = @{
 14        env = New-KrOpenApiServerVariable -Default 'dev' -Enum @('dev', 'staging', 'prod') -Description 'Environment nam
 15    }
 16    $server = New-KrOpenApiServer -Description 'My API Server' -Url 'https://api.example.com' -Variables $variables
 17.OUTPUTS
 18    Microsoft.OpenApi.OpenApiServer
 19#>
 20function New-KrOpenApiServer {
 21    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')]
 22    [KestrunRuntimeApi('Everywhere')]
 23    param(
 24        [Parameter(Mandatory)]
 25        [string]$Url,
 26        [string]$Description,
 27        [System.Collections.Specialized.OrderedDictionary]$Variables
 28    )
 029    $server = [Microsoft.OpenApi.OpenApiServer]::new()
 030    if ($PsBoundParameters.ContainsKey('Description')) {
 031        $server.Description = $Description
 32    }
 033    $server.Url = $Url
 034    if ($PsBoundParameters.ContainsKey('Variables')) {
 035        $server.Variables = [System.Collections.Generic.Dictionary[string, Microsoft.OpenApi.OpenApiServerVariable]]::ne
 036        foreach ($key in $Variables.Keys) {
 037            $value = $Variables[$key]
 038            $server.Variables.Add($key, $value)
 39        }
 40    }
 041    return $server
 42}

Methods/Properties

New-KrOpenApiServer()