Skip to content

http-client-java, escape javadoc for \u - #7663

Merged
Weidong Xu (weidongxu-microsoft) merged 4 commits into
microsoft:mainfrom
weidongxu-microsoft:http-client-java_escape-javadoc
Jun 20, 2025
Merged

http-client-java, escape javadoc for \u#7663
Weidong Xu (weidongxu-microsoft) merged 4 commits into
microsoft:mainfrom
weidongxu-microsoft:http-client-java_escape-javadoc

Conversation

@weidongxu-microsoft

Copy link
Copy Markdown
Contributor

@microsoft-github-policy-servicemicrosoft-github-policy-serviceBot added the emitter:client:java Issue for the Java client emitter: @typespec/http-client-java label Jun 17, 2025
@github-actions

Copy link
Copy Markdown
Contributor

No changes needing a change description found.

@azure-sdk

Copy link
Copy Markdown
Collaborator

You can try these changes here

🛝 Playground🌐 Website🛝 VSCode Extension

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Adds support for a new domainUsername property in the Java HTTP client model and ensures that backslash-unicode sequences in Javadoc are correctly escaped.

  • Introduces domainUsername in the TSP schema and propagates it through the generated model, serializers, and client docs.
  • Implements CodeNamer.escapeIllegalUnicodeEscape to catch invalid \u sequences and plugs it into line and Javadoc comment generation.
  • Adds unit tests for the new escape logic in CodeNamerTests.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
naming.tspDefined a new domainUsername property with a backslash in its doc string.
DataResponse.javaAdded domainUsername field, constructor parameter, getter, and JSON (de)serialization handling.
NamingOpsImpl.javaUpdated operation documentation to include domainUsername.
NamingAsyncClient.javaUpdated async client Javadoc to include domainUsername.
CodeNamerTests.javaAdded tests for escapeIllegalUnicodeEscape.
CodeNamer.javaImplemented escapeIllegalUnicodeEscape and factored out newStringBuilder.
JavaLineComment.javaPlugged escapeIllegalUnicodeEscape into line comments.
JavaJavadocComment.javaPlugged escapeIllegalUnicodeEscape into Javadoc comments.
Comments suppressed due to low confidence (1)

packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataResponse.java:166

  • Add unit tests to verify serialization and deserialization of the new domainUsername property on DataResponse (including null and special characters) to prevent regressions.
jsonWriter.writeStringField("domainUsername", this.domainUsername);

Merged via the queue into microsoft:main with commit 2d75a70Jun 20, 2025
@weidongxu-microsoft
Weidong Xu (weidongxu-microsoft) deleted the http-client-java_escape-javadoc branch June 20, 2025 02:44
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

client, handle when source contains \u## in doc

5 participants

@weidongxu-microsoft@azure-sdk@alzimmermsft@haolingdong-msft