< Summary - Kestrun — Combined Coverage

Information
Class: Public.OpenAPI.New-KrOpenApiExternalDoc
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/OpenAPI/New-KrOpenApiExternalDoc.ps1
Tag: Kestrun/Kestrun@ca54e35c77799b76774b3805b6f075cdbc0c5fbe
Line coverage
0%
Covered lines: 0
Uncovered lines: 5
Coverable lines: 5
Total lines: 59
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/5) Total lines: 36 Tag: Kestrun/Kestrun@826bf9dcf9db118c5de4c78a3259bce9549f0dcd01/11/2026 - 19:55:44 Line coverage: 0% (0/1) Total lines: 42 Tag: Kestrun/Kestrun@53c97a4806941d5aa8d4dcc6779071adf1ae537601/18/2026 - 06:40:41 Line coverage: 0% (0/5) Total lines: 59 Tag: Kestrun/Kestrun@99e92690d0fd95f6f4896f3410d2c024350a9794

Metrics

File(s)

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

#LineLine coverage
 1<#
 2.SYNOPSIS
 3    Creates a new OpenAPI External Documentation object.
 4.DESCRIPTION
 5    This function creates a new OpenAPI External Documentation object using the provided parameters.
 6.PARAMETER Server
 7    The Kestrun server instance to which the OpenAPI external documentation will be associated.
 8    If not specified, the function will attempt to resolve the current server context.
 9.PARAMETER Url
 10    A URI to the external documentation.
 11.PARAMETER Description
 12    A description of the external documentation.
 13.PARAMETER Extensions
 14    A collection of OpenAPI extensions to add to the external documentation.
 15.EXAMPLE
 16    # Create external documentation
 17    $externalDoc = New-KrOpenApiExternalDoc -Description 'Find out more about our API here.' -Url 'https://example.com/a
 18    Creates an external documentation object with the specified description and URL.
 19.EXAMPLE
 20    # Create external documentation with extensions
 21    $extensions = [ordered]@{
 22        'x-doc-type' = 'comprehensive'
 23        'x-contact' = 'Admin Team'
 24    }
 25    $externalDoc = New-KrOpenApiExternalDoc -Description 'Comprehensive API docs' -Url 'https://example.com/full-api-doc
 26    Creates an external documentation object with the specified description, URL, and extensions.
 27.NOTES
 28    This cmdlet is part of the OpenAPI module.
 29#>
 30function New-KrOpenApiExternalDoc {
 31    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')]
 32    [KestrunRuntimeApi('Definition')]
 33    param(
 34        [Parameter(Mandatory = $false, ValueFromPipeline = $true)]
 35        [Kestrun.Hosting.KestrunHost]$Server,
 36
 37        [Parameter(Mandatory = $true)]
 38        [Uri]$Url,
 39
 40        [Parameter(Mandatory = $false)]
 41        [string]$Description,
 42
 43        [Parameter(Mandatory = $false)]
 44        [System.Collections.IDictionary]$Extensions
 45    )
 46    begin {
 47        # Ensure the server instance is resolved
 048        $Server = Resolve-KestrunServer -Server $Server
 49    }
 50    process {
 51        # Create external documentation for the specified OpenAPI document
 052        if ($Server.OpenApiDocumentDescriptor.Count -gt 0 ) {
 053            $docDescriptor = $Server.DefaultOpenApiDocumentDescriptor
 054            return $docDescriptor.CreateExternalDocs($Url, $Description, $Extensions)
 55        } else {
 056            Write-KrLog -Level Warning 'New-KrOpenApiExternalDoc: No OpenAPI documents exist on the server.Create an Ope
 57        }
 58    }
 59}

Methods/Properties

New-KrOpenApiExternalDoc()