From b6c5dbafe5fae7584e95266840371ace84be41dc Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Tue, 21 Jul 2026 09:56:09 +0800 Subject: [PATCH] iothub: keep Java device-twin free-form maps as Object via alternateType RoutingTwin.tags, RoutingTwinProperties.desired and RoutingTwinProperties.reported are Record 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 --- .../resource-manager/Microsoft.Devices/IoTHub/client.tsp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/client.tsp b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/client.tsp index e5d123c6cd2f..93f1b61ea170 100644 --- a/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/client.tsp +++ b/specification/iothub/resource-manager/Microsoft.Devices/IoTHub/client.tsp @@ -39,6 +39,14 @@ using Http; "java" ); +// Preserve backward-compatible Java surface (free-form Object) for device twin +// free-form maps. These properties are `Record` in the spec, which the +// Java emitter maps to `Map`; prior releases generated `Object`. Keep `Object` +// for Java only to avoid a breaking change, while other languages keep `Map`. +@@alternateType(RoutingTwin.tags, unknown, "java"); +@@alternateType(RoutingTwinProperties.desired, unknown, "java"); +@@alternateType(RoutingTwinProperties.reported, unknown, "java"); + @@scope(GroupIdInformations.get, "!csharp"); @@scope(GroupIdInformations.list, "!csharp"); @@usage(GroupIdInformation, Usage.output, "csharp");