-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Enumeration values don't respect original letter casing in generated C# clients when used in URL query #1052
Comments
This causes my proxy to fail because the 3rd party API is case-sensitive :-/ |
The problem here is that |
looks like there is no specific reusable function to do that in the BCL. All resources I found suggested to use reflection directly, e.g. https://forums.asp.net/t/2050963.aspx?How+to+get+EnumMember+value+ |
Alternatively we could use some NuGet library to support it, but that would require introducing a 3rd party dependency... https://www.nuget.org/packages?q=string+enum |
It’s important that the generated code does not depend on 3rd party libraries except the BCL and Newtonsoft.Json (which cant be avoided). The biggest problem is, that we may need conditional logic for enums which make the templates even more complicated. We could however use:
|
This is issue still occurs - 14.1.0.0 , when creating C# Client
When generating the C# Client:
The first Case is in Upper, so it generates two W enum item |
Enumeration values don't respect original letter casing in generated C# clients when used in URL query
Sample Swagger:
The generated enumeration POCO (NSwagStudio v11.12.5.0):
The generated C# client method (NSwagStudio v11.12.5.0):
The requests sent by this method will use property names instead of EnumMember values.
I expect that the same issue may happen in URL paths.
The text was updated successfully, but these errors were encountered: