OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.77k stars 6.57k forks source link

[BUG] [csharp] Obsolete build warnings after PR to update to RestSharp 112.0.0 #19525

Open johnthagen opened 2 months ago

johnthagen commented 2 months ago

Bug Report Checklist

Description

Due to vulnerabilities in the current generated RestSharp version

I tried to update 7.8.0 generated C# client to RestSharp 112.0.0 as shown in

But this produced two build warnings. For projects that treat warnings as errors in CI, this will fail the build.

ApiClient.cs(400,17): warning CS0618: 'RestClientOptions.MaxTimeout' is obsolete: 'Use Timeout instead.'
ApiClient.cs(472,24): warning CS0618: 'RestClientExtensions.Deserialize<T>(IRestClient, RestResponse)' is obsolete: 'Please use the async overload with a cancellation token'

The related upstream changes in RestSharp:

Here are where these obsolete methods are still used within openapi-generator main branch:

https://github.com/OpenAPITools/openapi-generator/blob/e914c4098b44ac734d3dd21300d433f6cb2974a5/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache#L458

https://github.com/OpenAPITools/openapi-generator/blob/e914c4098b44ac734d3dd21300d433f6cb2974a5/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache#L557

openapi-generator version

7.8.0 (with #19507 backport manually applied)

johnthagen commented 2 months ago

CC @wing328

alec-petersen commented 3 weeks ago

Got a fix for this issue in review #19847