autorest icon indicating copy to clipboard operation
autorest copied to clipboard

AutoRest generates duplicate constructors for model with no properties

Open bitsforthought opened this issue 11 years ago • 1 comments

Given this Swagger:

"DataChangeDetectionPolicy": {
  "discriminator": "@odata.type",
  "properties": {
    "@odata.type": {
      "type": "string"
    }
  },
  "required": [
    "@odata.type"
  ]
},
"SqlIntegratedChangeTrackingPolicy": {
  "allOf": [
    {
      "$ref": "#/definitions/DataChangeDetectionPolicy"
    }
  ]
},

AutoRest generates two default constructors in C# for both DataChangeDetectionPolicy and SqlIntegratedChangeTrackingPolicy, which results in an error when compiling the generated code.

AutoRest should omit the second constructor when the model has no properties.

bitsforthought avatar Nov 11 '15 00:11 bitsforthought

I'm going to try to fix this.

bitsforthought avatar Nov 17 '15 00:11 bitsforthought