-
Notifications
You must be signed in to change notification settings - Fork 6k
C# code generation does not observe C# naming conventions #930
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
Comments
Should be addressed in #927 |
@wing328 This is partially addressed. If you look at the other classes (e.g., ApiClient), you'll see the same issues. |
@ThomasBarnekow please kindly take another look. I've also updated the indentation to use 4 spaces instead of 2. |
@wing328 That looks better now. I've seen that variable names are now in camelCase. However, there are a few other issues we could fix:
Do you want to fix that as well? I could propose some changes. |
For 1, I've updated the PR with your suggested way of comparison. Would you please elaborate on your 2nd and 3rd points with examples? I did a quick look again but couldn't find those you're referring to. |
@wing328 Regarding number 2, here's an example:
Note the In the following example, still pertaining to number 2, you turned parameter names into camelCase but did not change the comments:
Regarding number 3, here's an example (note the curly brackets laid out differently):
The first one is Java style. The second one is C# style. There is a mix of both. Again, that's a nitpick. Are you using ReSharper or any other tool that helps you spot these and possibly layout the code in a consistent way? |
@ThomasBarnekow thanks for the detailed feedback. I'll look for tools to analyse the auto-generated C# code. Later may need help from you again to review one more time. |
I use ReSharper. I have made changes to the |
@wing328 This is off-topic, but you should also have a look at the overall architecture ... For example, the Further, is it possible to change the namespace of those generated classes? |
@ThomasBarnekow would be great if you can send me the diff of the ApiClient class. Thanks for the feedback about the design. The default parameters were there before I started working on this project. I keep it as there may be valid use cases using the default parameters. About customizing name space, you can do so by providing a config file (e.g. config.json) via the
|
@wing328 Where do you want me to send that? I could also just send the original file. |
Please send to my personal email address listed in my github profile. |
@ThomasBarnekow pushed another update to the PR with better C# style based on your feedback. |
@wing328 Thanks. Had a look. Here are some points ... Starting with
Moving on to the |
@ThomasBarnekow thanks for the suggestion. The reason why we put basePath in ApiClient is that the same configuration can be shared by more than one Api class (e.g. PetApi, StoreApi, UserApi) so that developers can avoid setting the basePath manually for each Api Class. For , please find more information from the below: For |
FYI. Updated the PR to use fully-qualified name "System.Threading.Tasks.Task" as suggested by another user. #956 |
@ThomasBarnekow is there anything else you would like to change/fix before we merge the PR (#927) ? |
@wing328 Nothing that I can see at the moment. |
@ThomasBarnekow the PR has been merged into |
C# uses Pascal case (e.g., PascalCase) for class, method, and property names, for example. C# uses camel case (e.g., camelCase) for variable and parameter names, among other things. The generated C# code uses an inconsistent naming scheme.
Firstly, properties use camel case. Examples include all properties in the
Configuration
class and theapiClient
property in the generatedXyzApi
class. For example, theapiClient
property should be calledApiClient
to be in in line with the conventions.Secondly, parameters in the generated operations are in PascalCase:
The correct form would be:
This would also be in line with the
swagger.json
, in which all these parameters are in fact in camel case. The code generation seems to actively turn them into Pascal case.Parameters of methods that are not generated based on the
swagger.json
are all in camel case. Thus, there is also some inconsistency.The text was updated successfully, but these errors were encountered: