-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update charp generator to generate RestSharp 107.x compliant source code, update other dependencies in generated packages.config #11744
Comments
I was able to make the changes pretty easily so I don't think it would be a big deal to make the required changes and there are actually security concerns with older version of RestSharp as well as Newtonsoft.json. |
I would love to second this. While I can change the generated code, it kind of defeats the purpose of generating code. |
@vahanij Like a complete diff between one client vs the updated one? I guess I could make a very simple one, but the ones I have are mostly private so wouldn't want to give them out, but I could provide some of the most common changes (VS picked up most of them by just clicking on the error. Things like Timeout, UserAgent, BaseUrl are now part of Options: Ex: I think that covers it all the changes I made and it was pretty easy. I would note of course that RestSharp changed to using a bunch of Microsoft libraries for things like parsing. I think a lot of that is to support newer versions of .net (I'm on 4.8 so nuget asked me to download them). For instance System.Text.Json is included, but a lot of the swagger hub codegen still uses Newtonsoft.Json. I didn't make any changes to not use that so it still relies on that, but I updated it to the newer version as I think the security related update was around Json parsing. I've read that the new Microsoft parsing is a lot quicker, but it doesn't yet handle some things Netwonsoft does. |
I updated another project and also noticed I had to add the reference |
Any updated on this? We are seeing an error that might be related to this issue. Just invoking the constructor generates runtime exception but compile-time shows no errors. The work-around we implemented was to use "fixed" RestSharp version v105.1 on the client consuming app as this is the version "Swagger Codegen" uses by default at the moment. Hope this helps someone else! |
Any updates on this? |
Please try using latest release 3.0.63+ which includes csharp generator refactor. Closing ticket, please reopen if still experiencing issues. |
Description
The csharp generator uses RestSharp 105.1.0 in its packages.config.
This dates to 4/30//2015.
While one can manually update to the latest 106.x release, the 107.x release is a breaking change from previous
RestSharp releases. See https://restsharp.dev/v107/#restsharp-v107
This requires changes to the generated source code.
Swagger-codegen version
The version used was the latest released on editor.swgger.io as of March 20, 2022, 3.0.33
Command line used for generation
Steps to reproduce
Create a client using the csharp language selected
Related issues/PRs
Suggest a fix/enhancement
Update the dependencies emitted by the csharp generator in general
The text was updated successfully, but these errors were encountered: