Repository: thrift Updated Branches: refs/heads/master f57b57ac0 -> f0f607ffa
THRIFT-3408: correct emitted JSON types This closes #679 Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/f0f607ff Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/f0f607ff Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/f0f607ff Branch: refs/heads/master Commit: f0f607ffacee42d133277518e3eb4835d1607386 Parents: f57b57a Author: Andrew Bloomgarden <[email protected]> Authored: Tue Nov 3 10:19:14 2015 -0500 Committer: Roger Meier <[email protected]> Committed: Wed Nov 4 12:32:44 2015 +0100 ---------------------------------------------------------------------- compiler/cpp/src/generate/t_json_generator.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/f0f607ff/compiler/cpp/src/generate/t_json_generator.cc ---------------------------------------------------------------------- diff --git a/compiler/cpp/src/generate/t_json_generator.cc b/compiler/cpp/src/generate/t_json_generator.cc index 3f44a82..10aaa64 100644 --- a/compiler/cpp/src/generate/t_json_generator.cc +++ b/compiler/cpp/src/generate/t_json_generator.cc @@ -701,8 +701,12 @@ string t_json_generator::get_type_name(t_type* ttype) { if (ttype->is_xception()) { return "exception"; } - //if (ttype->is_base_type() && ((t_base_type*)ttype)->is_binary()) { - return "binary"; + if (ttype->is_base_type()) { + t_base_type* tbasetype = (t_base_type*)ttype; + return tbasetype->is_binary() ? "binary" : t_base_type::t_base_name(tbasetype->get_base()); + } + + return "(unknown)"; } string t_json_generator::get_qualified_name(t_type* ttype) {
