diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 73b0d248f6f..5f3bf91683b 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -415,6 +415,9 @@ UniValue OpenRPCArgSchema(const RPCArg& arg, bool include_hidden, bool in_skip_t schema.pushKV("type", "object"); if (!arg.m_inner.empty()) { schema.pushKV("additionalProperties", OpenRPCArgSchema(arg.m_inner[0], include_hidden, in_skip_type_check)); + if (!arg.m_inner[0].m_description.empty()) { + schema.pushKV("description", arg.m_inner[0].m_description); + } } else { schema.pushKV("additionalProperties", true); } diff --git a/test/functional/rpc_openrpc.py b/test/functional/rpc_openrpc.py index d25d6daff0b..5a57e6251ad 100755 --- a/test/functional/rpc_openrpc.py +++ b/test/functional/rpc_openrpc.py @@ -75,7 +75,8 @@ class OpenRPCDocTest(BitcoinTestFramework): self.log.info("Checking relaxed schemas for unchecked RPC types") createrawtransaction = find_method(openrpc, "createrawtransaction") outputs = find_param(createrawtransaction, "outputs") - address_obj = { "type": "object", "additionalProperties": {"oneOf": [{"type": "number"},{"type": "string"}]}} + address_description = "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in BTC" + address_obj = {"type": "object", "additionalProperties": {"oneOf": [{"type": "number"},{"type": "string"}]}, "description": address_description} data_description = "A key-value pair. The key must be \"data\", the value is hex-encoded data that becomes a part of an OP_RETURN output" data_obj = {"type": "object", "properties": { "data": {"type": "string", "pattern": "^[0-9a-fA-F]+$", "description": data_description}}, "additionalProperties": False, "required": ["data"]} assert_equal(outputs["schema"], {"oneOf": [{"type": "array", "items": {"anyOf": [address_obj, data_obj]}}, {"type": "object"}]})