iothub: keep Java device-twin free-form maps as Object via alternateType - #44820
Merged
weidongxu-microsoft merged 1 commit intoJul 21, 2026
Conversation
RoutingTwin.tags, RoutingTwinProperties.desired and RoutingTwinProperties.reported are Record<unknown> in the spec, which the Java emitter maps to Map. Prior releases generated Object, so the current generation introduces a breaking change on the Java public surface (Object -> Map; withReported(Object)/withDesired(Object)/withTags(Object) removed). Add alternateType(..., unknown, java) to restore Object for Java only; other languages keep the more specific Map. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 96bded02-7a23-4e40-868b-7d3cd5bab141
weidongxu-microsoft
requested review from
marcodalessandro and
riteshrao
as code owners
July 21, 2026 01:56
Next Steps to Merge✅ All automated merging requirements have been met! To get your PR merged, see aka.ms/azsdk/specreview/merge.Comment generated by summarize-checks workflow run. |
API Change CheckAPIView identified API level changes in this PR and created the following API reviews
Comment generated by After APIView workflow run. |
XiaofeiCao
approved these changes
Jul 21, 2026
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
Restores the backward-compatible Java client surface for IoT Hub device-twin free-form maps.
RoutingTwin.tags, RoutingTwinProperties.desired, and RoutingTwinProperties.reported are modeled as
Record<unknown>inmodels.tsp, which the Java emitter maps toMap. Prior releases (api-version2025-08-01-preview,azure-resourcemanager-iothub1.4.0-beta.2) generatedObjectfor these properties. The current generation therefore introduces a breaking change on the Java public API:java.lang.Object reported()->java.util.Map reported()java.lang.Object desired()->java.util.Map desired()java.lang.Object tags()->java.util.Map tags()withReported(Object)/withDesired(Object)/withTags(Object)removedChange
Add
@@alternateType(..., unknown, "java")inclient.tspfor the three properties. TypeSpecunknownmaps to JavaObject, so the Java client keeps the originalObjectsurface while other languages continue to use the more specificMap. No wire/protocol change.This mitigates the breaking changes observed in azure-sdk-for-java PR #49868.