Skip to content
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

[csharp-netcore] Enum parameter serialization to use EnumMember value when provided. #11448

Merged

Conversation

jafin
Copy link
Contributor

@jafin jafin commented Jan 29, 2022

PR relates to #11447

Change method ParameterToString (ClientUtils) to check if obj is Enum and has a EnumMember prop. If so use that value over the existing logic of obj.ToString()

This fixes an issue whereby the enum value does not match the value in the openApi schema.

This PR also modifies the location of the yaml location for csharp-netcore/OpenAPIClient-net5.0, to a cloned copy of the java petstore API with changes to trigger the scenario described here. This was done to avoid disturbing clients (java) unrelated to this change.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (5.3.0), 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
    @mandrean (2017/08) @frankyjuang (2019/09) @shibayan (2020/02) @Blackclaws (2021/03) @lucamazzanti (2021/05)

jafin added 3 commits January 30, 2022 08:48
…lve. Move csharp-netcore-net50 to point to new yaml schema.
…alue instead of enum.ToString().

-Regenerate csharp samples to accomodate change.
@jafin jafin force-pushed the fix-csharp-enum-parameter-serialization branch from 4d3ded4 to f93765e Compare January 29, 2022 22:56
@wing328 wing328 added this to the 6.0.0 milestone Feb 15, 2022
@wing328
Copy link
Member

wing328 commented Feb 15, 2022

@wing328 wing328 modified the milestones: 6.0.0, 6.0.1 May 26, 2022
@jtreminio-dropbox
Copy link

This PR should have been merged months ago

@wing328 wing328 modified the milestones: 6.0.1, 6.1.0 Jul 5, 2022
@Ikelio
Copy link
Contributor

Ikelio commented Jul 23, 2022

Is there a way I can help resolving the conflicts ? Until this PR merges, any endpoint enum parameter which starts by a number, or a reserved word, will be generated incorrectly (that concerns a lot of API out there).

jafin added 2 commits July 24, 2022 20:36
…ameter-serialization

# Conflicts:
#	bin/configs/csharp-netcore-OpenAPIClient-net50.yaml
#	samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/PetApi.md
@jafin jafin force-pushed the fix-csharp-enum-parameter-serialization branch from 174d876 to a9dc972 Compare July 24, 2022 13:04
@wing328 wing328 modified the milestones: 6.1.0, 6.1.1 Sep 11, 2022
@wing328 wing328 modified the milestones: 6.1.1, 6.2.1 Sep 24, 2022
@wing328
Copy link
Member

wing328 commented Oct 19, 2022

Sorry for the delay in reviewing this PR. There're too many PRs submitted this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants