fix: Relax error when full or accounts set to false (#1540)

Fixes #1537
This commit is contained in:
Alex Kremer
2024-07-12 15:44:46 +01:00
committed by GitHub
parent 4f6f717bfb
commit b12d916276
2 changed files with 12 additions and 11 deletions

View File

@@ -70,9 +70,8 @@ public:
* - ledger * - ledger
* - type * - type
* *
* Clio will throw an error when `queue` is set to `true` * Clio will throw an error when `queue`, `full` or `accounts` is set to `true`.
* or if `full` or `accounts` are used. * @see https://github.com/XRPLF/clio/issues/603 and https://github.com/XRPLF/clio/issues/1537
* @see https://github.com/XRPLF/clio/issues/603
*/ */
struct Input { struct Input {
std::optional<std::string> ledgerHash; std::optional<std::string> ledgerHash;
@@ -105,9 +104,9 @@ public:
spec([[maybe_unused]] uint32_t apiVersion) spec([[maybe_unused]] uint32_t apiVersion)
{ {
static auto const rpcSpec = RpcSpec{ static auto const rpcSpec = RpcSpec{
{JS(full), validation::NotSupported{}}, {JS(full), validation::Type<bool>{}, validation::NotSupported{true}},
{JS(full), check::Deprecated{}}, {JS(full), check::Deprecated{}},
{JS(accounts), validation::NotSupported{}}, {JS(accounts), validation::Type<bool>{}, validation::NotSupported{true}},
{JS(accounts), check::Deprecated{}}, {JS(accounts), check::Deprecated{}},
{JS(owner_funds), validation::Type<bool>{}}, {JS(owner_funds), validation::Type<bool>{}},
{JS(queue), validation::Type<bool>{}, validation::NotSupported{true}}, {JS(queue), validation::Type<bool>{}, validation::NotSupported{true}},

View File

@@ -79,25 +79,25 @@ generateTestValuesForParametersTest()
"AccountsInvalidBool", "AccountsInvalidBool",
R"({"accounts": true})", R"({"accounts": true})",
"notSupported", "notSupported",
"Not supported field 'accounts'", "Not supported field 'accounts's value 'true'",
}, },
{ {
"AccountsInvalidInt", "AccountsInvalidInt",
R"({"accounts": 123})", R"({"accounts": 123})",
"notSupported", "invalidParams",
"Not supported field 'accounts'", "Invalid parameters.",
}, },
{ {
"FullInvalidBool", "FullInvalidBool",
R"({"full": true})", R"({"full": true})",
"notSupported", "notSupported",
"Not supported field 'full'", "Not supported field 'full's value 'true'",
}, },
{ {
"FullInvalidInt", "FullInvalidInt",
R"({"full": 123})", R"({"full": 123})",
"notSupported", "invalidParams",
"Not supported field 'full'", "Invalid parameters.",
}, },
{ {
"QueueExist", "QueueExist",
@@ -304,6 +304,8 @@ TEST_F(RPCLedgerHandlerTest, ConditionallyNotSupportedFieldsDefaultValue)
auto const handler = AnyHandler{LedgerHandler{backend}}; auto const handler = AnyHandler{LedgerHandler{backend}};
auto const req = json::parse( auto const req = json::parse(
R"({ R"({
"full": false,
"accounts": false,
"queue": false "queue": false
})" })"
); );