Skip to content

Commit b65ac67

Browse files
committed
fix: Relax error when full or accounts set to false (#1540)
Fixes #1537
1 parent 7b18e28 commit b65ac67

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/rpc/handlers/Ledger.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ class LedgerHandler {
7070
* - ledger
7171
* - type
7272
*
73-
* Clio will throw an error when `queue` is set to `true`
74-
* or if `full` or `accounts` are used.
75-
* @see https://github.com/XRPLF/clio/issues/603
73+
* Clio will throw an error when `queue`, `full` or `accounts` is set to `true`.
74+
* @see https://github.com/XRPLF/clio/issues/603 and https://github.com/XRPLF/clio/issues/1537
7675
*/
7776
struct Input {
7877
std::optional<std::string> ledgerHash;
@@ -105,9 +104,9 @@ class LedgerHandler {
105104
spec([[maybe_unused]] uint32_t apiVersion)
106105
{
107106
static auto const rpcSpec = RpcSpec{
108-
{JS(full), validation::NotSupported{}},
107+
{JS(full), validation::Type<bool>{}, validation::NotSupported{true}},
109108
{JS(full), check::Deprecated{}},
110-
{JS(accounts), validation::NotSupported{}},
109+
{JS(accounts), validation::Type<bool>{}, validation::NotSupported{true}},
111110
{JS(accounts), check::Deprecated{}},
112111
{JS(owner_funds), validation::Type<bool>{}},
113112
{JS(queue), validation::Type<bool>{}, validation::NotSupported{true}},

tests/unit/rpc/handlers/LedgerTests.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,25 +79,25 @@ generateTestValuesForParametersTest()
7979
"AccountsInvalidBool",
8080
R"({"accounts": true})",
8181
"notSupported",
82-
"Not supported field 'accounts'",
82+
"Not supported field 'accounts's value 'true'",
8383
},
8484
{
8585
"AccountsInvalidInt",
8686
R"({"accounts": 123})",
87-
"notSupported",
88-
"Not supported field 'accounts'",
87+
"invalidParams",
88+
"Invalid parameters.",
8989
},
9090
{
9191
"FullInvalidBool",
9292
R"({"full": true})",
9393
"notSupported",
94-
"Not supported field 'full'",
94+
"Not supported field 'full's value 'true'",
9595
},
9696
{
9797
"FullInvalidInt",
9898
R"({"full": 123})",
99-
"notSupported",
100-
"Not supported field 'full'",
99+
"invalidParams",
100+
"Invalid parameters.",
101101
},
102102
{
103103
"QueueExist",
@@ -304,6 +304,8 @@ TEST_F(RPCLedgerHandlerTest, ConditionallyNotSupportedFieldsDefaultValue)
304304
auto const handler = AnyHandler{LedgerHandler{backend}};
305305
auto const req = json::parse(
306306
R"({
307+
"full": false,
308+
"accounts": false,
307309
"queue": false
308310
})"
309311
);

0 commit comments

Comments
 (0)