microsoft / microsoft/mcp

[Tracking] Migrate enum-like POCO string options to typed enums

Open
#3,131 1 comment 1 reaction 1 assignee Claimed by @alzimmermsft View on GitHub
enhancement tools-Core
Dominant language
C#
Stars
3.7k
Forks
624
Avg merge
2d 20h
Merged PRs (30d)
220

Description

## Problem

POCO option classes still expose closed value sets as strings. Invalid values can reach command or service code, be silently ignored or defaulted, or fail only after subscription and ARM work. Typed enums let the option binder reject invalid input before command execution, provide case-insensitive binding and completions, and make service mappings exhaustive at compile time.

## Scope

This is a tracking issue. Inventory closed-set string properties declared with `Option` on POCO option classes, then migrate them through child issues and one toolset per pull request.

Before migrating values that are not valid CLR identifiers, add an AOT-safe core mechanism that maps stable public option tokens to enum members. The current binder validates only `Enum.GetNames` and binds with `Enum.Parse`, so values such as `from-project`, `github-actions`, and `RSA-HSM` cannot be converted without changing the public CLI contract.

Known implementation work:

- #3129 covers SQL database create/update read-scale validation.
- Initial inventory found at least 55 additional candidates across Advisor, AppService, AzureMigrate, Compute, Deploy, EventHubs, Extension, KeyVault, ManagedLustre, Postgres, Storage, and Fabric OneLake.
- Create one child issue per affected toolset after validating its candidate list.

## Requirements for each migration

- Preserve existing public option names and accepted value tokens.
- Reject unknown values during option binding, before command execution or Azure API work.
- Preserve documented case-insensitive behavior.
- Carry the typed value through command and service boundaries, with an exhaustive mapping when the Azure SDK uses an extensible struct instead of a CLR enum.
- Add tests for each accepted value, mixed-case input, invalid input, defaults, and omitted nullable values.
- Update generated command metadata, documentation, and changelog entries when validation changes observable behavior.

## Out of scope

- Open-ended strings.
- Numeric ranges or closed numeric sets, which need value validators rather than enums.
- Legacy options that have not yet moved to POCO binding.
- Renaming existing public value tokens.

## Completion criteria

- The full candidate inventory is linked from this issue.
- The core alias prerequisite is complete or every remaining candidate can preserve its public token with the existing binder.
- Each affected toolset has a bounded child issue and is migrated in its own pull request.
- All child issues are complete and invalid enum-like values fail before command execution.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.