Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParameterSetName and mandatory validtion #42

Open
schwallers opened this issue Dec 3, 2020 · 1 comment
Open

ParameterSetName and mandatory validtion #42

schwallers opened this issue Dec 3, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@schwallers
Copy link

I don't think paramtersetname is working correctly.
When using parametersets the mandatory setting validation is taking priority over the parametersets.
The below param setting should make C mandatory if using A and optional if using B. Currently all 3 are mandatory and that results in an "AmbiguousParameterSet" error on submit.

param
(
[parameter(ParameterSetName="AandC", mandatory=$true)]
[switch]$a,
[parameter(ParameterSetName="BandC", mandatory=$true)]
[switch]$b,
[parameter(ParameterSetName="AandC", mandatory=$true)]
[parameter(ParameterSetName="BandC", mandatory=$false)]
[switch]$c
}

@markdomansky markdomansky added the wontfix This will not be worked on label Dec 4, 2020
@markdomansky
Copy link
Owner

ParameterSetName is not supported. Depending on your use case, it can be made to work, without the mandatory fields and doing validation within the function.

@stale stale bot removed the wontfix This will not be worked on label Dec 4, 2020
@markdomansky markdomansky added the enhancement New feature or request label Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants