platyPS icon indicating copy to clipboard operation
platyPS copied to clipboard

Update-MarkdownHelp does not merge YAML block for parameter

Open sdwheeler opened this issue 6 years ago • 2 comments
trafficstars

I am trying to update the help for the CimCmdlets module. The parameter -CimSession has a list of parameter sets in the existing content. That list is missing one parameter set name. Rather than adding the missing name, it create a second YAML block for the parameter listing the missing parameter set name.

This is happening for multiple parameters.

Steps to reproduce

  1. Copy the files from https://github.com/PowerShell/PowerShell-Docs/tree/staging/reference/6/CimCmdlets
  2. Run Update-MarkdownHelp on that folder.

Expected behavior

The YAML block for -CimSession should be:

Type: CimSession[]
Parameter Sets: ClassNameSessionSet, CimInstanceSessionSet, CimClassSessionSet, QuerySessionSet, ResourceUriSessionSet
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

Actual behavior

The YAML block for -CimSession is:

Type: CimSession[]
Parameter Sets: ClassNameSessionSet, CimInstanceSessionSet, CimClassSessionSet, QuerySessionSet
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Type: CimSession[]
Parameter Sets: ResourceUriSessionSet
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

Environment data

PS > Get-Module platyPS -list | select name,version

Name    Version
----    -------
platyPS 0.12.0

PS > $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.1.1
PSEdition                      Core
GitCommitId                    6.1.1
OS                             Microsoft Windows 10.0.17134
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

sdwheeler avatar Dec 18 '18 21:12 sdwheeler

Hm interesting, another problem there is that Aliases : misses the newline.

Parameter Sets: ClassNameSessionSet, CimInstanceSessionSet, CimClassSessionSet, QuerySessionSet Aliases:

vors avatar Dec 21 '18 19:12 vors

In general, multiple yaml blocks are ok and expected when some metadata for the parameter is inconsistent between different parameter sets. For instance, when one of them has it as a required parameter and one has it as optional. I read this code the other day and I cannot spot why it triggers in this case and from a glancing over it seems that metadata is consistent between the param sets. A more elaborate debugging is needed here...

vors avatar Jan 13 '19 06:01 vors

This issue is not longer relevant with the new design for Microsoft.PowerShell.PlatyPS v1.0

theJasonHelmick avatar May 17 '24 20:05 theJasonHelmick