Azure / autorest.typescript

Extension for AutoRest (https://github.com/Azure/autorest) that generates TypeScript code. The transpiled javascript code is isomorphic. It can be run in browser and in node.js environment.
MIT License
179 stars 75 forks source link

[hlc] generate unexpected enum if swagger has multiple identical x-ms-enum.name definitions #2789

Open kazrael2119 opened 2 months ago

kazrael2119 commented 2 months ago

here are the two provisioningState definitions from swagger: 1:

"provisioningState": {
              "type": "string",
              "description": "Provisioning state.",
              "enum": [
                "created"
              ],
              "x-ms-enum": {
                "name": "ProvisioningState",
                "modelAsString": false
              }
            }

2:

"provisioningState": {
          "readOnly": true,
          "type": "string",
          "description": "The current provisioning state of the API Management gateway config connection ",
          "enum": [
            "Activating",
            "Canceled",
            "Failed",
            "Succeeded",
            "Terminating",
            "Upgrading",
            "Updating"
          ],
          "x-ms-enum": {
            "name": "ProvisioningState",
            "modelAsString": true
          }
        },

they have the same x-ms-enum,name and m4 will merge these two enum values which is unexpected PS: if the first one has value[] or both of them have value[] in x-ms-enum , the second one will be missed stead of merging together