Azure / autorest.csharp

Extension for AutoRest (https://github.com/Azure/autorest) that generates C# code
MIT License
143 stars 166 forks source link

Construct URL issue with OData API #165

Open cristipufu opened 6 years ago

cristipufu commented 6 years ago

Hello,

I'm using Autorest version: 2.0.4283; node: v8.11.1, as I'm trying to generate a C# client for an OData API.

There seems to be an issue with the Construct URL section:

...

// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "odata/LicensesRuntime({Key})/UiPath.Server.Configuration.OData.ToggleEnabled").ToString();
 _url = _url.Replace("{key}", System.Uri.EscapeDataString(key));

// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;

...

It tries to replace {key}, which is actually {Key} with the actual key value.

Regards, Cristi

fearthecowboy commented 6 years ago

workaround: Can you make {Key} lowercase in your swagger file ?

I'd have to go dig into why it's trying that.

cristipufu commented 6 years ago

The swagger file is automatically generated using Swashbuckle.OData, so that's not actually an option.