< Summary - Kestrun — Combined Coverage

Information
Class: Public.OpenAPI.New-KrOpenApiLink
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/OpenAPI/New-KrOpenApiLink.ps1
Tag: Kestrun/Kestrun@ca54e35c77799b76774b3805b6f075cdbc0c5fbe
Line coverage
0%
Covered lines: 0
Uncovered lines: 5
Coverable lines: 5
Total lines: 87
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/1) Total lines: 41 Tag: Kestrun/Kestrun@826bf9dcf9db118c5de4c78a3259bce9549f0dcd12/25/2025 - 19:20:44 Line coverage: 0% (0/28) Total lines: 105 Tag: Kestrun/Kestrun@5251f12f253e29f8a1dfb77edc2ef50b90a4f26f01/14/2026 - 07:55:07 Line coverage: 0% (0/28) Total lines: 104 Tag: Kestrun/Kestrun@13bd81d8920e7e63e39aafdd188e7d766641ad3501/18/2026 - 21:37:07 Line coverage: 0% (0/5) Total lines: 87 Tag: Kestrun/Kestrun@99c4ae445e8e5afc8b7080e01d5d9cdf39f972b8

Metrics

File(s)

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

#LineLine coverage
 1<#
 2.SYNOPSIS
 3    Creates a new OpenAPI Link object.
 4.DESCRIPTION
 5    This function creates a new OpenAPI Link object that can be used to define relationships between operations
 6    in an OpenAPI specification. Links allow you to specify how the output of one operation can be used as input to anot
 7.PARAMETER Server
 8    The Kestrun server instance to which the OpenAPI link will be associated.
 9    If not specified, the function will attempt to resolve the current server context.
 10.PARAMETER OperationRef
 11    A reference to an existing operation in the OpenAPI specification using a JSON Reference.
 12.PARAMETER OperationId
 13    The operationId of an existing operation in the OpenAPI specification.
 14.PARAMETER Description
 15    A description of the link.
 16.PARAMETER OpenApiServer
 17    An OpenAPI Server object that specifies the server to be used for the linked operation.
 18.PARAMETER Parameters
 19    A hashtable mapping parameter names to runtime expressions or literal objects that define the parameters for the lin
 20.PARAMETER RequestBody
 21    A runtime expression or literal object that defines the request body for the linked operation.
 22.PARAMETER Extensions
 23    A collection of OpenAPI extensions to add to the link.
 24.EXAMPLE
 25    $link = New-KrOpenApiLink -OperationId "getUser" -Description "Link to get user details" -Parameters @{ "userId" = "
 26    This link creates a new OpenAPI Link object that links to the "getUser" operation, with a description and parameters
 27.EXAMPLE
 28    $link = New-KrOpenApiLink -OperationRef "#/paths/~1users~1{userId}/get" -Description "Link to get user details"
 29    This link creates a new OpenAPI Link object that links to the operation referenced by the provided JSON Reference, w
 30.OUTPUTS
 31    Microsoft.OpenApi.OpenApiLink object.
 32.NOTES
 33    This function is part of the Kestrun PowerShell module for working with OpenAPI specifications.
 34#>
 35function New-KrOpenApiLink {
 36    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')]
 37    [KestrunRuntimeApi('Definition')]
 38    [OutputType([Microsoft.OpenApi.OpenApiLink])]
 39    [CmdletBinding(DefaultParameterSetName = 'ByOperationId')]
 40    param(
 41        [Parameter(Mandatory = $false, ValueFromPipeline = $true)]
 42        [Kestrun.Hosting.KestrunHost]$Server,
 43
 44        [Parameter(Mandatory = $true, ParameterSetName = 'ByOperationRef')]
 45        [ValidateNotNullOrEmpty()]
 46        [string]$OperationRef,
 47
 48        [Parameter(Mandatory = $true, ParameterSetName = 'ByOperationId')]
 49        [ValidateNotNullOrEmpty()]
 50        [string]$OperationId,
 51
 52        [Parameter()]
 53        [string]$Description,
 54
 55        [Parameter()]
 56        [Microsoft.OpenApi.OpenApiServer]$OpenApiServer,
 57
 58        [Parameter()]
 59        [System.Collections.IDictionary]$Parameters,
 60
 61        [Parameter()]
 62        [object] $RequestBody,
 63
 64        [Parameter()]
 65        [System.Collections.IDictionary]$Extensions
 66    )
 67
 68    begin {
 69        # Ensure the server instance is resolved
 070        $Server = Resolve-KestrunServer -Server $Server
 71    }
 72    process {
 73        # Create link for the specified OpenAPI document
 074        if ($Server.OpenApiDocumentDescriptor.Count -gt 0 ) {
 075            $docDescriptor = $Server.DefaultOpenApiDocumentDescriptor
 076            $link = $docDescriptor.NewOpenApiLink(
 77                $OperationRef,
 78                $OperationId,
 79                $Description,
 80                $OpenApiServer,
 81                $Parameters,
 82                $RequestBody,
 83                $Extensions)
 084            return $link
 85        }
 86    }
 87}

Methods/Properties

New-KrOpenApiLink()