platyPS icon indicating copy to clipboard operation
platyPS copied to clipboard

Merge multiple YAML blocks for parameter metadata into one YAML block

Open sdwheeler opened this issue 2 years ago • 0 comments

Summary of the new feature / enhancement

When a parameter belongs to multiple parameter sets, the current version of PlatyPS creates multiple YAML blocks when the parameter has different metadata in different parameter sets.

For example, a parameter can be required in one set and optional in another. Rather than have separate YAML blocks, create a single YAML block with the aggregated information.

Here is an example from Invoke-Command for -ApplicationName:

Type: System.String
Parameter Sets: FilePathComputerName, ComputerName
Aliases:

Required: False
Position: Named
Default value: $PSSessionApplicationName if set on the local computer, otherwise WSMAN
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

Here is an example for -Credential

Type: System.Management.Automation.PSCredential
Parameter Sets: ComputerName, FilePathComputerName, Uri, FilePathUri, VMId, VMName, FilePathVMId, FilePathVMName
Aliases:

Required: True (VMId, VMName, FilePathVMId, FilePathVMName), False (ComputerName, FilePathComputerName, Uri, FilePathUri)
Position: Named
Default value: Current user
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

The Parameters Sets: metadata should list all sets that the parameter belongs to. The Required: metdata should list the sets where is is true and where it is false. If it is true or false for all sets in Parameter sets: then just list the boolean value.

Also note that Accept pipeline input: should list the type of pipeline input (ByValue or ByPropertyName).

Proposed technical implementation details (optional)

No response

sdwheeler avatar Jun 23 '22 18:06 sdwheeler