< Summary - Kestrun — Combined Coverage

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

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/OpenAPI/Build-KrOpenApiDocument.ps1

#LineLine coverage
 1<#
 2.SYNOPSIS
 3    Builds the OpenAPI document for the specified Kestrun server.
 4.DESCRIPTION
 5    This function builds the OpenAPI document for the specified Kestrun server using the discovered components.
 6.PARAMETER Server
 7    The Kestrun server instance for which the OpenAPI document will be built.
 8    If not specified, the function will attempt to resolve the current server context.
 9.PARAMETER DocId
 10    The ID of the OpenAPI document to build. Default is 'default'.
 11.EXAMPLE
 12    # Build the OpenAPI document for the default document ID
 13    Build-KrOpenApiDocument -Server $myServer -DocId 'default'
 14.OUTPUTS
 15    Kestrun.OpenApi.OpenApiDocumentDescriptor
 16#>
 17function Build-KrOpenApiDocument {
 18    [KestrunRuntimeApi('Everywhere')]
 19    param(
 20        [Parameter(Mandatory = $false, ValueFromPipeline = $true)]
 21        [Kestrun.Hosting.KestrunHost]$Server,
 22        [Parameter()]
 23        [string]$DocId = [Kestrun.Authentication.IOpenApiAuthenticationOptions]::DefaultSchemeName
 24    )
 25    begin {
 26        # Ensure the server instance is resolved
 027        $Server = Resolve-KestrunServer -Server $Server
 028        Write-KrLog -Level Information -Logger $Server.Logger -Message 'Building OpenAPI document...'
 29    }
 30    process {
 031        if ( -not $Server.OpenApiDocumentDescriptor.ContainsKey($DocId)) {
 032            throw "OpenAPI document with ID '$DocId' does not exist on the server."
 33        }
 034        Get-KrAnnotatedFunctionsLoaded
 035        $doc = $Server.OpenApiDocumentDescriptor[$DocId]
 036        $doc.GenerateDoc()
 37    }
 38}

Methods/Properties

Build-KrOpenApiDocument()