Skip to content

iothub: keep Java device-twin free-form maps as Object via alternateType - #44820

Merged
weidongxu-microsoft merged 1 commit into
Azure:mainfrom
weidongxu-microsoft:iothub-java-alternatetype-routingtwin
Jul 21, 2026
Merged

iothub: keep Java device-twin free-form maps as Object via alternateType#44820
weidongxu-microsoft merged 1 commit into
Azure:mainfrom
weidongxu-microsoft:iothub-java-alternatetype-routingtwin

Conversation

@weidongxu-microsoft

Copy link
Copy Markdown
Member

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> in models.tsp, which the Java emitter maps to Map. Prior releases (api-version 2025-08-01-preview, azure-resourcemanager-iothub 1.4.0-beta.2) generated Object for 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) removed

Change

Add @@alternateType(..., unknown, "java") in client.tsp for the three properties. TypeSpec unknown maps to Java Object, so the Java client keeps the original Object surface while other languages continue to use the more specific Map. No wire/protocol change.

This mitigates the breaking changes observed in azure-sdk-for-java PR #49868.

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
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added ARMReview resource-manager TypeSpec Authored with TypeSpec WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required ARMAutoSignedOff-Trivial ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review and removed WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required labels Jul 21, 2026
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

API Change Check

APIView identified API level changes in this PR and created the following API reviews

Language API Review for Package
TypeSpec Microsoft.Devices
Go sdk/resourcemanager/iothub/armiothub
JavaScript @azure/arm-iothub
Python azure-mgmt-iothub
C# Azure.ResourceManager.IotHub
Java com.azure.resourcemanager:azure-resourcemanager-iothub

Comment generated by After APIView workflow run.

@weidongxu-microsoft weidongxu-microsoft added the PublishToCustomers Acknowledgement the changes will be published to Azure customers. label Jul 21, 2026
@weidongxu-microsoft
weidongxu-microsoft merged commit 8126197 into Azure:main Jul 21, 2026
86 checks passed
@weidongxu-microsoft
weidongxu-microsoft deleted the iothub-java-alternatetype-routingtwin branch July 21, 2026 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ARMAutoSignedOff-Trivial ARMReview ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review IoTHub PublishToCustomers Acknowledgement the changes will be published to Azure customers. resource-manager TypeSpec Authored with TypeSpec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants