no-boolean
@azure-tools/typespec-azure-core/no-booleanBoolean properties should use descriptive extensible enums when semantic values matter.
Boolean values can be hard for API users to understand when the property or payload represents a domain state, option, or mode. Prefer a descriptive extensible enum modeled as a union so future values can be added without a breaking change.
Impact
Section titled “Impact”- Area: SDK, API
Boolean shapes can make generated clients less readable and can force future breaking changes if the API later needs more than two values.
LintDiff Equivalent
Section titled “LintDiff Equivalent”This rule corresponds to the LintDiff rule EnumInsteadOfBoolean.
Incorrect
Section titled “Incorrect”model Widget { enabled: boolean;}@getop isWidgetEnabled(): boolean;Correct
Section titled “Correct”union WidgetState { Enabled: "Enabled", Disabled: "Disabled", string,}
model Widget { state: WidgetState;}@getop getWidgetState(): WidgetState;Suppression
Section titled “Suppression”Suppress this rule only when the value is inherently boolean and is unlikely to grow additional states, such as a simple yes/no capability.