Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Dynamic Parameters are too Difficult to Construct #20395

Copy link
Copy link
@StartAutomating

Description

@StartAutomating
Issue body actions

Summary of the new feature / enhancement

As a heavy user of dynamic parameters, I often find myself tripping over their basic failures in constructability.

Dynamic Parameters are needlessly difficult to construct.

The shortest possible constructor is:

[Management.Automation.RuntimeDefinedParameter]::new("A", [psobject], @())

and it fails in an entreatingly confusing way, informing me that I could not bind "A" to "AllParameterSets", without telling me why.

Dynamic Parameters should be easier to construct.

The need goes beyond simplifying existing implementation and fixing its buggier parts:

A very common scenario is exposing dynamic parameters from one command to another.

This should also be easier to construct

Proposed technical implementation details (optional)

  • Add simplified constructors to [Management.Automation.RuntimeDefinedParameter]
    • Constructing from only a name should create a [PSObject] parameter that accepts ValueFromPipelineByPropertyName
    • Constructing from a name and a type should add an empty [Parameter()] attribute
  • Allow [Management.Automation.RuntimeDefinedParameter] to be coerced from [Management.Automation.ParameterMetadata]
  • Create extension methods to assist in custom conversion to [Management.Automation.RuntimeDefinedParameter]
  • Enable adding dictionaries to [Management.Automation.RuntimeDefinedParameterDictionary]
  • Adding type accelerators [DynamicParameter], [DynamicParameters], so that less typing is required to create them.
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.