autorest icon indicating copy to clipboard operation
autorest copied to clipboard

CSharp: When composite Swagger files are used, build fails due to a lower case parameter name.

Open hyonholee opened this issue 10 years ago • 1 comments

I have two Swagger json files and both files have the following parameters:

"parameters": {
  "SubscriptionIdParameter": {
    "name": "subscriptionId",
    "in": "path",
    "required": true,
    "type": "string",
    "description": "Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call."
  },
  "ApiVersionParameter": {
    "name": "api-version",
    "in": "query",
    "required": true,
    "type": "string",
    "description": "Client Api Version."
  }
}

However, when I generated MAML from these files, I got a build error because one of them has ‘subscriptionId’ (starting with lower case ‘s’) instead of ‘SubscriptionId’.

Generated from the first Swagger file:

if (this.Client.SubscriptionId == null)
{
    throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}

Generated from the second Swagger file:

if (this.Client.subscriptionId == null)
{
    throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.subscriptionId");
}

hyonholee avatar Feb 29 '16 23:02 hyonholee

@hyonholee thank you for the issue report. We'll check it out.

I took the liberty of doing a little reformatting. If I changed the meaning of anything, please correct me.

devigned avatar Feb 29 '16 23:02 devigned