no-nullable
@azure-tools/typespec-azure-core/no-nullableUse ? for optional properties.
Properties are most often not nullable but optional.
Do not use | null to specify that a property is nullable. Instead, use the ? operator to indicate that a property is optional.
Impact
Section titled “Impact”- Area: API, SDK
A nullable property is usually a mistake where an optional property was intended.
❌ Incorrect
Section titled “❌ Incorrect”model Pet { id: string; owner: string | null;}✅ Correct
Section titled “✅ Correct”model Pet { id: string; owner?: string;}Suppression
Section titled “Suppression”Suppress only when required to match an existing API; otherwise use an optional property.