< Summary - Kestrun — Combined Coverage

Information
Class: Public.OpenAPI.Add-KrOpenApiTag
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/OpenAPI/Add-KrOpenApiTag.ps1
Tag: Kestrun/Kestrun@ca54e35c77799b76774b3805b6f075cdbc0c5fbe
Line coverage
0%
Covered lines: 0
Uncovered lines: 4
Coverable lines: 4
Total lines: 78
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/12) Total lines: 61 Tag: Kestrun/Kestrun@826bf9dcf9db118c5de4c78a3259bce9549f0dcd01/11/2026 - 19:55:44 Line coverage: 0% (0/4) Total lines: 78 Tag: Kestrun/Kestrun@53c97a4806941d5aa8d4dcc6779071adf1ae5376

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/OpenAPI/Add-KrOpenApiTag.ps1

#LineLine coverage
 1<#
 2.SYNOPSIS
 3    Adds a tag to the OpenAPI document.
 4.DESCRIPTION
 5    This function adds a tag to the OpenAPI document using the provided parameters in the specified OpenAPI documents in
 6.PARAMETER Server
 7    The Kestrun server instance to which the OpenAPI tag will be added.
 8    If not specified, the function will attempt to resolve the current server context.
 9.PARAMETER DocId
 10    An array of OpenAPI document IDs to which the tag will be added. Default is 'default'.
 11.PARAMETER Name
 12    The name of the tag.
 13.PARAMETER Summary
 14    A short summary of the tag.
 15.PARAMETER Description
 16    A description of the tag.
 17.PARAMETER Parent
 18    The name of the parent tag, if this tag is a sub-tag.
 19.PARAMETER Kind
 20    A machine-readable string to categorize what sort of tag it is.
 21.PARAMETER ExternalDocs
 22    An OpenAPI External Documentation object associated with the tag.
 23.PARAMETER Extensions
 24    A collection of OpenAPI extensions to add to the tag.
 25.EXAMPLE
 26    # Add a tag to the default document
 27    Add-KrOpenApiTag -Name 'MyTag' -Description 'This is my tag.' `
 28        -ExternalDocs (New-KrOpenApiExternalDoc -Description 'More info' -Url 'https://example.com/tag-info')
 29    Adds a tag named 'MyTag' with a description and external documentation link to the default OpenAPI document.
 30.EXAMPLE
 31    # Add a tag to multiple documents
 32    Add-KrOpenApiTag -DocId @('Default', 'v2') -Name 'MultiDocTag' -Summary 'Tag for multiple docs'
 33    Adds a tag named 'MultiDocTag' with a summary to both the 'Default' and 'v2' OpenAPI documents.
 34.NOTES
 35    This cmdlet is part of the OpenAPI module.
 36#>
 37function Add-KrOpenApiTag {
 38    [KestrunRuntimeApi('Definition')]
 39    param(
 40        [Parameter(Mandatory = $false, ValueFromPipeline = $true)]
 41        [Kestrun.Hosting.KestrunHost]$Server,
 42        [Parameter()]
 43        [string[]]$DocId = [Kestrun.OpenApi.OpenApiDocDescriptor]::DefaultDocumentationIds,
 44
 45        [Parameter(Mandatory = $true)]
 46        [string]$Name,
 47
 48        [Parameter()]
 49        [string]$Summary,
 50
 51        [Parameter()]
 52        [string]$Description,
 53
 54        [Parameter()]
 55        [string]$Parent,
 56
 57        [Parameter()]
 58        [string]$Kind,
 59
 60        [Parameter()]
 61        [Microsoft.OpenApi.OpenApiExternalDocs]$ExternalDocs,
 62
 63        [Parameter()]
 64        [System.Collections.IDictionary]$Extensions
 65    )
 66    begin {
 67        # Ensure the server instance is resolved
 068        $Server = Resolve-KestrunServer -Server $Server
 69    }
 70    process {
 71        # Add the server to the specified OpenAPI documents
 072        foreach ($doc in $DocId) {
 073            $docDescriptor = $Server.GetOrCreateOpenApiDocument($doc)
 74
 075            $null = $docDescriptor.AddTag($Name, $Description, $Summary, $Parent, $Kind, $ExternalDocs, $Extensions)
 76        }
 77    }
 78}

Methods/Properties

Add-KrOpenApiTag()