platyPS icon indicating copy to clipboard operation
platyPS copied to clipboard

Inputs duplicated for parameters with ValueFromPipeline and array

Open pkaz91 opened this issue 5 months ago • 1 comments

Prerequisites

  • [x] Write a descriptive title.
  • [x] Make sure you are able to repro it on the latest version
  • [x] Search the existing issues.

Steps to reproduce

I have a function that supports ValueFromPipeline for an array parameter e.g.

function Get-Computer {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory,ValueFromPipeline)]
        [string[]]
        $ComputerName
    )
    Write-Output "Found $ComputerName"
}

When I use New-MarkdownCommandHelp to create help for this function, it adds two blocks under ## INPUTS:

### System.String

{{ Fill in the Description }}

### System.String[]

{{ Fill in the Description }}

Every time I update this file via the following code:

Measure-PlatyPSMarkdown -Path .\testmodule\docs\test_module\*.md | Update-MarkdownCommandHelp -Path {$_.FilePath} -NoBackup

It adds another System.String block to the top of the ## INPUTS like so:

### System.String

{{ Fill in the Description }}

Expected behavior

No additional inputs are created when I run `Update-MarkdownCommandHelp`

Actual behavior

Additional `System.String` blocks are added at the top of `## INPUTS`:

### System.String

{{ Fill in the Description }}

Error details


Environment data

PSVersion                      7.5.2
PSEdition                      Core
GitCommitId                    7.5.2
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

1.0.0 GA

Visuals

This image shows the state of the file after running New-MarkdownCommandHelp to create the help file and Update-MarkdownCommandHelp twice more: Image

pkaz91 avatar Jul 28 '25 20:07 pkaz91

Interesting. The design for Update-MarkdownHelp is to not remove INPUTS or OUTPUTS that exist because an author may have added the information for cmdlets that do properly report their outputs.

But there may be a problem in the New-MarkdownCommandHelp not creating the entries properly. We need to investigate this.

sdwheeler avatar Jul 30 '25 15:07 sdwheeler