Azure / autorest.java

Extension for AutoRest (https://github.com/Azure/autorest) that generates Java code
MIT License
32 stars 80 forks source link

Clean up patch serialization #2772

Closed alzimmermsft closed 1 month ago

alzimmermsft commented 1 month ago

Removes the redundant null checks in JSON merge patch serialization as JSON merge patch has an explicit case for nullness.

weidongxu-microsoft commented 1 month ago

The format of comment seems not correct. https://dev.azure.com/azure-sdk/internal/_build/results?buildId=3795962&view=logs&j=ca395085-040a-526b-2ce8-bdc85f692774&t=c310a698-906e-53a5-78f7-614142e7c740&l=30

     /*
-     * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.",
+     * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will
+     * be ARM resource ids in the form:
+     * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/
+     * userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.",
      * 
      * Additional properties
      */

A long string should better not be break in the middle.

alzimmermsft commented 1 month ago

The format of comment seems not correct. https://dev.azure.com/azure-sdk/internal/_build/results?buildId=3795962&view=logs&j=ca395085-040a-526b-2ce8-bdc85f692774&t=c310a698-906e-53a5-78f7-614142e7c740&l=30

     /*
-     * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.",
+     * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will
+     * be ARM resource ids in the form:
+     * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/
+     * userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.",
      * 
      * Additional properties
      */

A long string should better not be break in the middle.

I wonder if it broke the string here since there is a leading ' but not a trailing ', I'll play around with that a bit. Luckily, in the produced Javadoc there won't be a newline as it's HTML where line breaks are ignored.

Edit

Also just realized these are line comments, so the formatting matters less.