Skip to content

CLI resource command does not validate dependent choice inputs #16907

@JamesNK

Description

@JamesNK

Description

When using aspire resource with named command options, validation of choice inputs does not work correctly for dependent choices.

If an invalid choice is given for a preloaded choice, it fails with a good error message. But if the same thing is done for a dependent choice (one that loads its values when a prior input is set), the invalid value is allowed through without validation.

The CLI should validate dependent choice values against their allowed options, just like it does for preloaded choices.

Steps to reproduce

  1. Run a resource command that has a dependent choice input (a choice whose allowed values are loaded based on a prior input value)
  2. Provide an invalid value for the dependent choice
  3. Observe that the invalid value is accepted instead of being rejected

Expected behavior

The CLI should reject invalid values for dependent choice inputs and display an error message listing the allowed values, consistent with how preloaded choice validation works.

Actual behavior

Invalid values for dependent choice inputs are silently accepted and sent to the resource command.


From #16903 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplicationbug

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions