< Summary - Kestrun — Combined Coverage

Information
Class: Private.OpenAPI.Get-KrAnnotatedFunctionsLoaded
Assembly: Kestrun.PowerShell.Private
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Private/OpenAPI/Get-KrAnnotatedFunctionsLoaded.ps1
Tag: Kestrun/Kestrun@0d738bf294e6281b936d031e1979d928007495ff
Line coverage
0%
Covered lines: 0
Uncovered lines: 7
Coverable lines: 7
Total lines: 43
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/7) Total lines: 43 Tag: Kestrun/Kestrun@826bf9dcf9db118c5de4c78a3259bce9549f0dcd

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Private/OpenAPI/Get-KrAnnotatedFunctionsLoaded.ps1

#LineLine coverage
 1<#
 2.SYNOPSIS
 3    Loads OpenAPI-annotated PowerShell functions into a KestrunHost instance.
 4.DESCRIPTION
 5    The Get-KrAnnotatedFunctionsLoaded cmdlet scans all loaded PowerShell functions
 6    in the current runspace for OpenAPI annotations and loads them into the specified
 7    KestrunHost instance as API routes.
 8.PARAMETER Server
 9    The KestrunHost instance to load the annotated functions into. If not specified,
 10    the default KestrunHost instance will be used.
 11.PARAMETER DocId
 12    The ID of the OpenAPI document to build. Default is 'default'.
 13.EXAMPLE
 14    Get-KrAnnotatedFunctionsLoaded -Server $myKestrunHost
 15    Loads all OpenAPI-annotated functions into the specified KestrunHost instance.
 16.NOTES
 17    This cmdlet is designed to be used within the context of a KestrunHost instance.
 18#>
 19function Get-KrAnnotatedFunctionsLoaded {
 20    [CmdletBinding()]
 21    param(
 22        [Parameter(Mandatory = $false, ValueFromPipeline = $true)]
 23        [Kestrun.Hosting.KestrunHost]$Server,
 24        [Parameter()]
 25        [string]$DocId = [Kestrun.Authentication.IOpenApiAuthenticationOptions]::DefaultSchemeName
 26    )
 27    begin {
 28        # Ensure the server instance is resolved
 029        $Server = Resolve-KestrunServer -Server $Server
 30
 31        # All loaded functions now in the runspace
 032        $funcs = @(Get-Command -CommandType Function | Where-Object {
 033                $null -eq $_.Module -and $null -eq $_.PsDrive
 34            })
 35    }
 36    process {
 037        if ( -not $Server.OpenApiDocumentDescriptor.ContainsKey($DocId)) {
 038            throw "OpenAPI document with ID '$DocId' does not exist on the server."
 39        }
 040        $doc = $Server.OpenApiDocumentDescriptor[$DocId]
 041        $doc.LoadAnnotatedFunctions( $funcs )
 42    }
 43}