Skip to content

Commit deb5aec

Browse files
yishengjin1413vors
authored andcommitted
fix full type name in syntax (#284)
1 parent 97b49e3 commit deb5aec

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/Markdown.MAML/Model/MAML/MamlParameter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class MamlParameter : ICloneable
1111

1212
public string Type { get; set; }
1313

14+
public string FullType { get; set; }
15+
1416
public string Name { get; set; }
1517

1618
public bool Required { get; set; }

src/platyPS/platyPS.psm1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2249,14 +2249,9 @@ function ConvertPsObjectsToMamlModel
22492249
$ParameterObject.Required = $Parameter.IsMandatory
22502250
$ParameterObject.PipelineInput = getPipelineValue $Parameter
22512251
$ParameterType = $Parameter.ParameterType
2252-
$ParameterObject.Type = if ($UseFullTypeName)
2253-
{
2254-
$ParameterType.FullName
2255-
}
2256-
else
2257-
{
2258-
getTypeString -typeObject $ParameterType
2259-
}
2252+
$ParameterObject.Type = getTypeString -typeObject $ParameterType
2253+
$ParameterObject.FullType = $ParameterType.FullName
2254+
22602255
$ParameterObject.ValueRequired = -not ($Parameter.Type -eq "SwitchParameter") # thisDefinition is a heuristic
22612256

22622257
foreach($Alias in $Parameter.Aliases)
@@ -2507,6 +2502,11 @@ function ConvertPsObjectsToMamlModel
25072502
$Parameter = Get-ParameterByName $ParameterName
25082503
if ($Parameter)
25092504
{
2505+
if ($UseFullTypeName)
2506+
{
2507+
$Parameter = $Parameter.Clone()
2508+
$Parameter.Type = $Parameter.FullType
2509+
}
25102510
$MamlCommandObject.Parameters.Add($Parameter)
25112511
}
25122512
else

test/Pester/PlatyPs.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ Type: System.Management.Automation.SwitchParameter
406406
407407
'@
408408
$expectedSyntax = normalizeEnds @'
409-
Get-Alpha [[-WhatIf] <System.Management.Automation.SwitchParameter>] [[-CCC] <System.String>]
409+
Get-Alpha [-WhatIf] [[-CCC] <String>]
410410
411411
'@
412412

@@ -887,7 +887,7 @@ Type: System.String
887887
888888
'@
889889
$expectedSyntax = normalizeEnds @'
890-
Get-MyCoolStuff [[-Foo] <System.String>] [[-Bar] <System.String>] [<CommonParameters>]
890+
Get-MyCoolStuff [[-Foo] <String>] [[-Bar] <String>] [<CommonParameters>]
891891
892892
'@
893893
$v3markdown | Where-Object {$_.StartsWith('Type: ')} | Out-String | Should Be $expectedParameters

0 commit comments

Comments
 (0)