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

Fix string comparison in C++ UE4 client generator #7029

Merged
merged 2 commits into from
Jul 28, 2020
Merged

Conversation

wing328
Copy link
Member

@wing328 wing328 commented Jul 23, 2020

  • Fix string comparison in C++ UE4 client generator

CC @ravinikam (2017/07) @stkrwork (2017/07) @etherealjoy (2018/02) @MartinDelille (2018/03) @muttleyxd (2019/08)

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. 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
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

cc @Kahncode as well - the author of the generator

@@ -220,7 +220,6 @@ void OpenAPIPetApi::FindPetsByStatusResponse::SetHttpResponseCode(EHttpResponseC
switch ((int)InHttpResponseCode)
{
case 200:
default:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has something else changed? These default clauses are needed if I remember correctly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there was a fix. Previously the first response code is considered the default, which is incorrect as default should be defined separately.

Shall we revise the code to throw an exception instead as the response code is not defined in the spec?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this code does not support exceptions. Essentially if the response code was undefined in the spec I assumed it was a correct response. You may change that default behavior but I believe my tests ended up concluding that this was the best case scenario.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about logging an error message instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll merge this PR which aims to fix the string comparison.

The issue (default case has gone) is present in the generator regardless of this PR.

@wing328 wing328 merged commit 321ad3c into master Jul 28, 2020
@wing328 wing328 deleted the cpp-ue4-fix-compare branch July 28, 2020 02:15
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