platyPS
platyPS copied to clipboard
Incorrect Syntax generated for Parameters with multiple Positions
Steps to reproduce
have function like this:
function ConvertTo-Type{
param(
[Parameter(Position = 0,Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName,ParameterSetName='ExplicitType')]
[Parameter(Position = 1,Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName,ParameterSetName='NamedType')][AllowNull()]$InputObject,
[Parameter(Position = 1,Mandatory,ParameterSetName='ExplicitType')][ValidateNotNull()][type]$TargetType,
[Parameter(Position = 0,Mandatory,ParameterSetName='NamedType')][ValidateNotNullOrEmpty()][string]$TargetTypeIdentifier
)
process
{
#TODO
}
}
Generate new-MarkdownHelp
Expected behavior
Syntax is like Get-Command ConvertTo-Type -Syntax:
ConvertTo-Type [-TargetTypeIdentifier] <string> [-InputObject] <Object> [<CommonParameters>]
ConvertTo-Type [-InputObject] <Object> [-TargetType] <type> [<CommonParameters>]
Actual behavior
Output Syntax in Markdown is:
### NamedType
```
ConvertTo-Type [-InputObject] <Object> [-TargetTypeIdentifier] <String> [<CommonParameters>]
```
### ExplicitType
```
ConvertTo-Type [-InputObject] <Object> [-TargetType] <Type> [<CommonParameters>]
```
Paramterinfo for $InputObject is also only available once (there should be multiple yamls right?):
### -InputObject
{{ Fill InputObject Description }}
```yaml
Type: Object
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```
Environment data
PSVersion: 7.1.2 OS: Windows
I know this is probably a wierd edgecase 😅
@Herrmel Thanks you for adding this issue - can you tell me what version of PlatyPS you are using for this?
I just tested this with PlatyPS 0.14.2 and got the same result.
Microsoft.PowerShell.PlatyPS v1 now creates parameter metadata for each parameter set.