autorest icon indicating copy to clipboard operation
autorest copied to clipboard

AutoRest generates a weird code.

Open hyonholee opened this issue 6 years ago • 1 comments

When we generate .NET SDK from the latest master (https://github.com/Azure/azure-rest-api-specs/ ), we found that some weird string is generated.

The type name of VirtualMachineIdentityUserAssignedIdentitiesValue is changed to Components 1h8m3epschemasvirtualmachineidentitypropertiesuserassignedidentitiesadditionalproperties.

We run generate.ps1 from compute: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/compute/Microsoft.Azure.Management.Compute/src/generate.ps1

And the Swagger spec regarding the above is here: https://github.com/Azure/azure-rest-api-specs/blob/master/specification/compute/resource-manager/Microsoft.Compute/stable/2019-07-01/compute.json#L8370

    "userAssignedIdentities": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "principalId": {
            "readOnly": true,
            "type": "string",
            "description": "The principal id of user assigned identity."
          },
          "clientId": {
            "readOnly": true,
            "type": "string",
            "description": "The client id of user assigned identity."
          }
        }
      },
      "description": "The list of user identities associated with the virtual machine scale set. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'."
    }
  },

And we haven’t changed this part.

hyonholee avatar Feb 27 '20 21:02 hyonholee

Try setting -AutoRestVersion "latest" to -AutoRestVersion "V2"

Or, if using autorest directly, put --version:V2 on the command line

fearthecowboy avatar Mar 20 '20 18:03 fearthecowboy