platyPS
platyPS copied to clipboard
Update-MarkdownHelp does not merge YAML block for parameter
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
- Copy the files from https://github.com/PowerShell/PowerShell-Docs/tree/staging/reference/6/CimCmdlets
- 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
Hm interesting, another problem there is that Aliases : misses the newline.
Parameter Sets: ClassNameSessionSet, CimInstanceSessionSet, CimClassSessionSet, QuerySessionSet Aliases:
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...
This issue is not longer relevant with the new design for Microsoft.PowerShell.PlatyPS v1.0