Skip to content

Conversation

@weidongxu-microsoft
Copy link
Contributor

@weidongxu-microsoft weidongxu-microsoft commented Feb 9, 2026

fix #9638

Turns out the problem is in the mock data, we should use JSON string with double quote

            .withUnknown(BinaryData.fromBytes("\"dataxmqci\"".getBytes(StandardCharsets.UTF_8)))
            .withUnknownDict(
                mapOf("gdtopbobjogh", BinaryData.fromBytes("\"datavhkhixu\"".getBytes(StandardCharsets.UTF_8))))
            .withUnknownArray(Arrays.asList(BinaryData.fromBytes("\"dataw\"".getBytes(StandardCharsets.UTF_8))))
            .withUnknownDictArray(Arrays
                .asList(mapOf("hrzayvvtpgvdf", BinaryData.fromBytes("\"dataa\"".getBytes(StandardCharsets.UTF_8)))));

So, the change to element.writeTo is not strictly necessary. However. the change should improve better performance, as it no longer require another conversions to Object.


downstream
Azure/autorest.java#3283

sdk sync on dev

@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 Feb 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

All changed packages have been documented.

  • @typespec/http-client-java
Show changes

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

Fix mock data for BinaryData.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 9, 2026

Open in StackBlitz

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http@9639
npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-client@9639
npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-client-java@9639

commit: 9536019

@azure-sdk
Copy link
Collaborator

azure-sdk commented Feb 9, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@weidongxu-microsoft weidongxu-microsoft added this pull request to the merge queue Feb 10, 2026
Merged via the queue into microsoft:main with commit fe4c590 Feb 10, 2026
31 checks passed
@weidongxu-microsoft weidongxu-microsoft deleted the http-client-java_bug-fix-serialization-dict-of-unknown branch February 10, 2026 03:20
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.

[Bug]: http-client-java, mock data as JSON string need to have double quote on its value, for BinaryData

3 participants