Support XML serialization in http-client-java generator#11305
Merged
weidongxu-microsoft merged 12 commits intoJul 21, 2026
Merged
Support XML serialization in http-client-java generator#11305weidongxu-microsoft merged 12 commits into
weidongxu-microsoft merged 12 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a10e9989-905e-4380-a221-01c04f4da1f7
Add XmlSerializer/XmlSerializerProviders in the implementation package and route the toObject/fromObject convenience methods through the XML serializer overload so XML clients serialize XML instead of JSON. Add jackson-dataformat-xml for error-body decoding. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a10e9989-905e-4380-a221-01c04f4da1f7
… models Emit XmlSerializer and XmlSerializerProviders implementation classes from the generator when any generating model is used in XML (azure-v1 flavor). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a10e9989-905e-4380-a221-01c04f4da1f7
…enience methods Convenience method templates now declare a static XML ObjectSerializer and use the toObject/fromObject(serializer) overloads when the request/response content type is XML (azure-core v1 flavor). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a10e9989-905e-4380-a221-01c04f4da1f7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a10e9989-905e-4380-a221-01c04f4da1f7
Contributor
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
…t-java Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a10e9989-905e-4380-a221-01c04f4da1f7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a10e9989-905e-4380-a221-01c04f4da1f7
…nt template Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a10e9989-905e-4380-a221-01c04f4da1f7
weidongxu-microsoft
force-pushed
the
http-client-java_dpg-xml
branch
from
July 20, 2026 05:49
128b933 to
733e444
Compare
Contributor
Author
|
fix #11306 |
weidongxu-microsoft
marked this pull request as ready for review
July 20, 2026 06:23
weidongxu-microsoft
requested review from
XiaofeiCao,
alzimmermsft and
haolingdong-msft
as code owners
July 20, 2026 06:23
… files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a10e9989-905e-4380-a221-01c04f4da1f7
XiaofeiCao
approved these changes
Jul 21, 2026
XiaofeiCao
left a comment
Member
There was a problem hiding this comment.
Haven't dive deep into the codegen. Generated models looks good.
weidongxu-microsoft
added a commit
to Azure/typespec-azure
that referenced
this pull request
Jul 21, 2026
- Update core-commit.json to microsoft/typespec d012e83 (XML serialization, microsoft/typespec#11305). - Sync emitter test src/tsp via SyncTests.ps1. - Generate.ps1: skip payload/xml via the generateScript filter (early return, matching core's skip pattern) instead of Remove-Item on the specs folder. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cd6f2e08-d6d3-42ae-affd-bc71e98086f7
weidongxu-microsoft
added a commit
to Azure/typespec-azure
that referenced
this pull request
Jul 21, 2026
- Update core-commit.json to microsoft/typespec d012e83 (XML serialization, microsoft/typespec#11305). - Sync emitter test src/tsp via SyncTests.ps1 (adds payload/xml XmlTests). - Generate.ps1: stop removing the payload/xml specs folder so xml is generated, matching core (which no longer skips xml). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cd6f2e08-d6d3-42ae-affd-bc71e98086f7
weidongxu-microsoft
added a commit
to Azure/typespec-azure
that referenced
this pull request
Jul 21, 2026
## Summary - Update `packages/typespec-java/core-commit.json` to microsoft/typespec [d012e83](microsoft/typespec@d012e83) (Support XML serialization in http-client-java generator, microsoft/typespec#11305). - Sync emitter test `src`/`tsp` from core via `SyncTests.ps1` (adds `emitter-tests/src/test/java/payload/xml` XmlTests). - `emitter-tests/Generate.ps1`: stop removing `payload/xml` specs now that the emitter supports XML models. - Add chronus changelog entry (fix) mirroring the upstream XML serialization change. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds XML serialization support to the
@typespec/http-client-javagenerator (azure-core v1 flavor).When any model is serialized/deserialized as XML, the generator now:
XmlSerializer(anObjectSerializerbacked byazure-xml+ reflectivefromXml(XmlReader)) andXmlSerializerProviders(factory). Emission is gated onisAzureV1()and any generating model withClientModel::isUsedInXml.SERIALIZERfield is declared on sync/async convenience clients, andBinaryData.fromObject(input, SERIALIZER)/toObject(X.class, SERIALIZER)are emitted when the request/response content type is XML.The azure-v2 / clientcore flavor handles
XmlSerializablenatively and is unaffected. Non-XML output is unchanged.Changes
XmlSerializer.java/XmlSerializerProviders.java; XML-awareSupportedMimeTypehandling inConvenienceMethodTemplateBase,ConvenienceSyncMethodTemplate,ConvenienceAsyncMethodTemplate; staticSERIALIZERfield inServiceSyncClientTemplate/ServiceAsyncClientTemplate; constants inClientModelUtil.TypeSpecPlugin.writeHelperClassesemits the two helper files for XML models.payload/xmlspec, regenerated clients, and ported the XML test suite.Testing
payload.xml.XmlTests: 26 run, 0 failures, 2 skipped (namespace scenarios).tsp compile→ generated output adopted intosrcmatches, tests green.