Skip to content

Commit

Permalink
[cpp-ue4] bug-fix issue 10205: response json parsing logging a error …
Browse files Browse the repository at this point in the history
…to unreal console when there is no actual parsing problem (#10221)

* [cpp-ue4] Fixed a bug where respose json parsing was not taking 'writeOnly' or 'required' into account and was logging a error to the console when there was no actual problem.

* [cpp-ue4] Moved comments to tail of line in response to improve code appearance.  Added baseName to comments for clarity of reading.

* [cpp-ue4] removed comments from template from previous commits.

* [cpp-ue4] added back ParseSuccess flag flip for TOptional, as the templated version of TryGetJsonValue does actually handle the absense of the field correctly for TOptional.

* [cpp-ue4] reworked looping in model source template's FromJson to better mirror the loop in WriteJson

* [cpp-ue4] more concise version of writeOnly change to FromJson
  • Loading branch information
leith-bartrich authored Aug 26, 2021
1 parent 691a10a commit 0948a95
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,14 @@ bool {{classname}}::FromJson(const TSharedPtr<FJsonValue>& JsonValue)

bool ParseSuccess = true;

{{#vars}}
{{#vars}}
{{#required}}
{{^isWriteOnly}}ParseSuccess &= {{/isWriteOnly}}TryGetJsonValue(*Object, TEXT("{{baseName}}"), {{name}});
{{/required}}
{{^required}}
ParseSuccess &= TryGetJsonValue(*Object, TEXT("{{baseName}}"), {{name}});
{{/vars}}
{{/required}}
{{/vars}}

return ParseSuccess;
{{/isString}}
Expand Down

0 comments on commit 0948a95

Please sign in to comment.