-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Fix C# client enum issue #774
Conversation
/// <summary> | ||
/// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 | ||
/// </summary> | ||
[EnumMember(Value = "-1.2")] | ||
NUMBER_MINUS_1_DOT_2 = 2 | ||
NUMBER_MINUS_1_DOT_2 = -1.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jimschubert @albator1932 For double/float value, do we need to restore the old behavior (using the string representation of the value)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it's not ok:
Model\EnumTest.cs(126,30): error CS0266: Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are you missing a cast?) [C:\projects\openapi-generator\samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools\Org.OpenAPITools.csproj]
Model\EnumTest.cs(131,36): error CS0266: Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are you missing a cast?) [C:\projects\openapi-generator\samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools\Org.OpenAPITools.csproj]
Let me fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed via ec5ca85
@wing328 I think this looks good. I can't tell if you're done making changes, though, so I haven't merged. Can you comment when it's ready to go? |
@jimschubert yup, thanks for the review. Just merged it. |
* master: (32 commits) Fixed date formatting in typescript node client (OpenAPITools#786) better explain usage (OpenAPITools#794) Fix float/double default value in C# generator (OpenAPITools#791) Enhancements to documentation generators (samples, default values, etc) (OpenAPITools#790) Remove duplicate variable declaration (OpenAPITools#792) Issue 758 root resource (OpenAPITools#771) Do not declare destructor as default when destructor is explicitly declared. (OpenAPITools#732) Fix C# client enum issue (OpenAPITools#774) [JavaScript] Update vulnerable dependencies (OpenAPITools#784) [Ruby] Fix method split (OpenAPITools#780) [Java][jaxrs-jersey] add sample with jaxrs-jersey + openapi v3 (OpenAPITools#778) update groupId in pom (OpenAPITools#779) [cpp-restsdk] Support multi-line descriptions (OpenAPITools#753) [Core] Resolve Inline Models (OpenAPITools#736) [gradle] Support nullable system property values (OpenAPITools#764) Correct URL for openapi-generator.cli.sh in README.md (OpenAPITools#770) Fixed the generation of model properties whose data type is a composed (allOf) schema (OpenAPITools#704) [JAX-RS][Spec] Add samples to CircleCI (OpenAPITools#759) minor update to python generator usage (OpenAPITools#762) [C++][Restbed/Pistache] Added fix for byte array (OpenAPITools#752) ...
* fix csharp enum issue * fix numeric enum value * add docstring to exlain isDataTypeString * fix docstring by adding return * fix ToJson in hash model * remove BaseValidate for map model * restore csproj file
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.master
,4.0.x
. Default:master
.Description of the PR
To fix #635
I've only run
./bin/csharp-petstore.sh
for easier review (diff). I'll run other C# client scripts to update all samples later.In addition to the fix, I've reformated the mustache templates to avoid trailing spaces and spaces in empty lines.
cc @jimschubert @mandrean @albator1932
Related PR: #737