Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

Enum values are referencable entities but lacked crossLanguageDefinitionId, inconsistent with other SDK types.

Changes

  • interfaces.ts: Added crossLanguageDefinitionId: string property to SdkEnumValueType interface
  • public-utils.ts: Extended getCrossLanguageDefinitionId() to accept EnumMember and generate IDs in format ParentEnum.memberName
  • types.ts: Populated crossLanguageDefinitionId in getSdkEnumValueWithDiagnostics() and getSdkUnionEnumValues()
  • tests: Added coverage for regular and union enum value IDs

Example

For enum WidgetService.Color { Red, Green, Blue }:

// Enum crossLanguageDefinitionId
"WidgetService.Color"

// Enum value crossLanguageDefinitionIds
"WidgetService.Color.Red"
"WidgetService.Color.Green"
"WidgetService.Color.Blue"

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/typespec-azure/typespec-azure/core/website/node_modules/.bin/../astro/astro.js build sh core�� ebsite/src/content/docs/docs/emitters/openapi3/reference node s/.bin/sh warn-as-error --sh . rsioning/referentspd doc . --enable-experimental --output-dir ../../website/src/content/docs/d--output-dir node core�� --noEmit node core/node_modules/.bin/node lint-typespec-liuname pnpm s/.bin/sh tp/reference (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[TCGC] enumvalue types should have crossLanguageDefinitionId</issue_title>
<issue_description>As a "referencable" entity, the enumvalue types should have a crossLanguageDefinitionId.

Actually I suggest we move the crossLanguageDefinitionId to the SdkTypeBase type to ensure every SdkType would have this property.</issue_description>

<agent_instructions>1. Add crossLanguageDefinitionId to the SdkEnumValueType type https://github.com/Azure/typespec-azure/blob/main/packages/typespec-client-generator-core/src/interfaces.ts#L470
2. Use this function and update to accept the enum value type https://github.com/Azure/typespec-azure/blob/main/packages/typespec-client-generator-core/src/public-utils.ts#L241 to get the cross language definition id
3. Add tests in this file https://github.com/Azure/typespec-azure/blob/main/packages/typespec-client-generator-core/test/public-utils/get-cross-language-definition-id.test.ts
</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add crossLanguageDefinitionId to SdkEnumValueType Add crossLanguageDefinitionId to SdkEnumValueType Jan 13, 2026
Copilot AI requested a review from iscai-msft January 13, 2026 20:17
@microsoft-github-policy-service microsoft-github-policy-service bot added the lib:tcgc Issues for @azure-tools/typespec-client-generator-core library label Jan 26, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 26, 2026

Open in StackBlitz

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/typespec-client-generator-core@3764

commit: 9d6e055

Copy link
Member

@tadelesh tadelesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. But I'm wondering if we need to move crossLanguageDefinitionId to the base type.

@iscai-msft
Copy link
Contributor

if we added it to the base type, then we should also have credential, endpoint, tuple, and dictionary types taking on cross language definition id. I think for those it largely makes sense not to have a cross language definition id

@iscai-msft iscai-msft marked this pull request as ready for review January 27, 2026 19:43
@azure-sdk
Copy link
Collaborator

All changed packages have been documented.

  • @azure-tools/typespec-client-generator-core
Show changes

@azure-tools/typespec-client-generator-core - feature ✏️

Add .crossLanguageDefinitionId. to SdkEnumValueType

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website

@iscai-msft iscai-msft added this pull request to the merge queue Jan 27, 2026
Merged via the queue into main with commit 124fce2 Jan 27, 2026
26 checks passed
@iscai-msft iscai-msft deleted the copilot/add-cross-language-id-to-enum branch January 27, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TCGC] enumvalue types should have crossLanguageDefinitionId

5 participants