Skip to content

http-client-java, support exact in clientName#10758

Open
weidongxu-microsoft wants to merge 9 commits into
microsoft:mainfrom
weidongxu-microsoft:http-client-java_support-exact
Open

http-client-java, support exact in clientName#10758
weidongxu-microsoft wants to merge 9 commits into
microsoft:mainfrom
weidongxu-microsoft:http-client-java_support-exact

Conversation

@weidongxu-microsoft
Copy link
Copy Markdown
Contributor

@weidongxu-microsoft weidongxu-microsoft commented May 21, 2026

fix Azure/autorest.java#3340

manual tested on https://github.com/Azure/typespec-azure/blob/main/packages/azure-http-specs/specs/azure/client-generator-core/exact-name/main.tsp
need its release to write e2e


Impl is relatively simple. If isExactName, set the name directly to language.java.name. And later in Java code this name will not get transformed (otherwise, Java code will do a transform from language.default.name to language.java.name).


It is not complete though. There is isExactName missing from some types. TCGC fixed but not released.
Azure/typespec-azure#4480

@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:java Issue for the Java client emitter: @typespec/http-client-java label May 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

All changed packages have been documented.

  • @typespec/http-client-java
Show changes

@typespec/http-client-java - feature ✏️

Support exact name from TCGC.

@azure-sdk-automation
Copy link
Copy Markdown

azure-sdk-automation Bot commented May 21, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for preserving “exact” names coming from TCGC in the Java HTTP client generator, ensuring the preprocessor doesn’t re-normalize names that were explicitly provided by the emitter.

Changes:

  • Preserve pre-set language.java.name values during the Java preprocessor rename pass (only generate a name when the Java name is missing/empty).
  • Populate language.java.name in the Java emitter when isExactName is set (parameters, headers, schemas, properties).
  • Add a Chronus changelog entry for @typespec/http-client-java.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/preprocessor/tranformer/Transformer.java Avoids overwriting existing Java names during rename transformations.
packages/http-client-java/emitter/src/code-model-builder.ts Sets Java names for “exact name” cases while building the code model.
.chronus/changes/http-client-java_support-exact-2026-4-21-17-10-37.md Changelog entry documenting the feature.

Comment thread packages/http-client-java/emitter/src/code-model-builder.ts Outdated
Comment thread packages/http-client-java/emitter/src/code-model-builder.ts Outdated
weidongxu-microsoft and others added 3 commits May 22, 2026 09:56
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:java Issue for the Java client emitter: @typespec/http-client-java

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support exact() Function for @clientName (TCGC 0.68.0)

2 participants