From eca65caadcddf43b2dace111bd7e4b0a2a9556c2 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 2 Apr 2020 15:12:32 +0000 Subject: Bugfix: RPC: Add missing commas and correct indentation of explicit ELISION --- src/rpc/util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index 32e0e1ec27..f7038aba8f 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -606,11 +606,11 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const switch (m_type) { case Type::ELISION: { // If the inner result is empty, use three dots for elision - sections.PushSection({indent_next + "...", m_description}); + sections.PushSection({indent + "..." + maybe_separator, m_description}); return; } case Type::NONE: { - sections.PushSection({indent + "None", Description("json null")}); + sections.PushSection({indent + "None" + maybe_separator, Description("json null")}); return; } case Type::STR: { -- cgit v1.2.3 From 26dcf3958187cbdc9ffc9438a5eebfcaf607f7e9 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 2 Apr 2020 15:22:55 +0000 Subject: Bugfix: RPC: Don't use a continuation elipsis after an elision elipsis --- src/rpc/util.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index f7038aba8f..c1f46f224b 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -643,10 +643,10 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const for (const auto& i : m_inner) { i.ToSections(sections, OuterType::ARR, current_indent + 2); } - if (m_type == Type::ARR) { + CHECK_NONFATAL(!m_inner.empty()); + if (m_type == Type::ARR && m_inner.back().m_type != Type::ELISION) { sections.PushSection({indent_next + "...", ""}); } else { - CHECK_NONFATAL(!m_inner.empty()); // Remove final comma, which would be invalid JSON sections.m_sections.back().m_left.pop_back(); } @@ -659,11 +659,11 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const for (const auto& i : m_inner) { i.ToSections(sections, OuterType::OBJ, current_indent + 2); } - if (m_type == Type::OBJ_DYN) { + CHECK_NONFATAL(!m_inner.empty()); + if (m_type == Type::OBJ_DYN && m_inner.back().m_type != Type::ELISION) { // If the dictionary keys are dynamic, use three dots for continuation sections.PushSection({indent_next + "...", ""}); } else { - CHECK_NONFATAL(!m_inner.empty()); // Remove final comma, which would be invalid JSON sections.m_sections.back().m_left.pop_back(); } -- cgit v1.2.3 From f32ab443a98e622afa601372454310aef1f380be Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 2 Apr 2020 15:28:05 +0000 Subject: Bugfix: RPC: JSON null is not "None" --- src/rpc/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index c1f46f224b..7e1fb7a59d 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -610,7 +610,7 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const return; } case Type::NONE: { - sections.PushSection({indent + "None" + maybe_separator, Description("json null")}); + sections.PushSection({indent + "null" + maybe_separator, Description("json null")}); return; } case Type::STR: { -- cgit v1.2.3