-
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
Request: support for C# .NET 3.5 client #983
Comments
@who thanks for the feedback. Do you mean updating the existing C# client to make it backward compatible with .Net 3.5 framework ? |
@wing328 That is one way to do it, yes, but the existing C# client uses many language features that don't translate back to 3.5 very well, so this could be tricky. |
@who if you can give me a bit more direction on what feature is not available in 3.5, I can start updating the template during weekend. |
@wing328 The biggest difference is the lack of I am going to fork and start working on a PR, but I could use some help if you'd like to collaborate. |
I have filed a question regarding Async capabilities in Resharper when using augmented .Net 3.5 here: restsharp/RestSharp#718 |
Update from @hallem (RestSharp dev)
|
@who thanks for following up with RestSharp dev. In this case, I would agree with your suggestion earlier to add a separate generator for C# .net 3.5. |
@wing328 Agreed; a separate generator is the solution. I actually put some work into implementing 3.5 support in the existing templates, but found that it required too many "if .net 3.5" and "if not .net 3.5" conditionals. |
Thanks @who. I've added unit testing for Petstore C# client: https://github.com/swagger-api/swagger-codegen/tree/develop_2.0/samples/client/petstore/csharp/SwaggerClientTest. You might find it useful in testing the C# .net 3.5 client that you're working on (likely you will need to remove the test cases for async method call) If you need any help or feedback, please let us (community) know. Once again thanks for your contribution! |
@wing328 The original intent I had for this request was to use swagger-codegen to generate .Net 3.5 managed libraries that I can use in Unity3D. However, as it turns out, the maximum .Net version supported for managed libraries in Unity3D is .Net 2.0. Therefore, I will also be making a .Net 2.0 generator specifically for use as a Unity3D library generator. |
@wing328 @who Have either of you started any work on this? I've actually experienced the same issue, but had no problem updating my libraries to .NET 4.5.2. I'd like to eventually revert those libraries back to .NET 3.5, because they'll at some point need to be consumed by a desktop application with Windows XP support. I'd be happy to start work on this issue. Are there any existing examples of how swagger-codegen handles a base language implementation (other than I think #1889 plays a big part in this issue. |
@jimschubert I do not have a chance to work on this. I agree with you that |
@wing328 Cool. I'll take a look at the typescript abstraction and start working on this NET 3.5 client. |
This feature should be complete. Pass |
Is there a command-line option that can unset a property {{^netStandard}}? I'm trying to backport some things to .net 2.0 before net standard... |
@tgraupmann If you pass -DtargetFramework=v3.5, you get the 3.5 code and not the .NET Standard changes. There's a .NET 2.0 generator. Any reason you're not using that? Or are you working on merging it to the main csharp generator? |
Also, |
Csharp .Net 2.0 generate lacks enum type support. It's coming in as a string versus the later exporter has a nice type. I'm manually merging as I remove some netstandard features. This is to work with Unity. Here's my Swagger definition with some enums for testing with .Net 2. https://raw.githubusercontent.com/tgraupmann/ChromaSwaggerDefinition/master/api/swagger/swagger.yaml You'll see EffectType comes through as a string instead of an enum. For enum {{{value}}} it has quotes around it. There doesn't seem to be a way for mustache to remove quotes from a string...
|
We add the quotes for string but not numeric value. This is to make sure both string and numeric enum are supported. If C# .net 2.0 generators support enum, would that meet your requirement? |
Currently, the C# generator in swagger-codegen conforms to .Net 4.5+.
It would be nice to have a .Net 3.5 compatible generator, so that the resulting DLL could be used in places where .Net 4.5 functionality is not possible.
The text was updated successfully, but these errors were encountered: