Skip to content

Use V prefix for digit-starting members in API version enums#3939

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/update-version-enum-prefixes
Draft

Use V prefix for digit-starting members in API version enums#3939
Copilot wants to merge 3 commits intomainfrom
copilot/update-version-enum-prefixes

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

Enum members in Versions enums that start with digits were being prefixed with the full enum type name (e.g., Versions20250101) instead of the conventional V prefix (e.g., V20250101) that teams were already manually applying via @@clientName.

Changes

  • emitModels.ts: When a digit-starting enum member gets its _ prefix replaced, check if the enum has UsageFlags.ApiVersionEnum. If so, use "V" instead of the full enum type name as the prefix.
  • New test scenario apiVersionWithDigitStartingMembers.md: Validates V prefix for backtick-quoted date-style version members.
  • Updated tests extends.md, enumKeyNorm.md: Reflect the new V prefix behavior for existing API version enum fixtures.

Before / After

// TypeSpec
enum Versions {
  `2025-01-01`: "2025-01-01",
}

// Before
export enum KnownVersions {
  Versions20250101 = "2025-01-01",
}

// After
export enum KnownVersions {
  V20250101 = "2025-01-01",
}

Copilot AI changed the title [WIP] Update numeric-starting enum members in Versions Use V prefix for digit-starting members in API version enums Apr 30, 2026
Copilot AI requested a review from kazrael2119 April 30, 2026 05:51
@kazrael2119
Copy link
Copy Markdown
Member

@copilot fix smoke test ci failure

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 30, 2026

@copilot fix smoke test ci failure

Fixed in commit 38fd45d. The smoke test was failing because 4 generated files in packages/typespec-test/test/ (batch_modular, ai, overloads_modular, widget_dpg) still had the old Versions prefix. I regenerated them with the new V prefix and the smoke test now passes locally ("All specs succeeded!").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should numeric-starting enum members in "Versions" use type name prefix or "V" prefix?

2 participants