aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/util.h
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-04-17 12:14:37 -0400
committerMarcoFalke <falke.marco@gmail.com>2020-04-17 12:16:42 -0400
commit244daa482151b5b9a8a145df0541880c8bdc03fc (patch)
treec19df511a4163efe49538c20e0bc83e2705b51d1 /src/rpc/util.h
parent54f812d9d29893c690ae06b84aaeab128186aa36 (diff)
parentfa168d754221a83cab0d2984a02c41cf6819e873 (diff)
downloadbitcoin-244daa482151b5b9a8a145df0541880c8bdc03fc.tar.xz
Merge #18607: rpc: Fix named arguments in documentation
fa168d754221a83cab0d2984a02c41cf6819e873 rpc: Document all aliases for first arg of listtransactions (MarcoFalke) fa5b1f067fcf8bebb23455dd8a16cde5068e79cd rpc: Document all aliases for second arg of getblock (MarcoFalke) fa86a4bbfc000593ae4ad9dcdaec3fd0c0406086 rpc: Rename first arg of generateblock RPC to "output" (MarcoFalke) Pull request description: This fixes a bug found with #18531: * Currently the named argument for `generateblock` is documented as `address/descriptor`, but the server only accepts a named argument of `address`. Fix it by changing the name to `output` for both the documentation and the server code. Also, add tests to prove the server understands the new name `output`. * Unrelated to that, there have been a bunch of aliases in the server code that are not present in the source code of the documentation. Fix that by adding the alias to the source code of the documentation. Only the first alias is displayed in the rendered documentation. Also, add tests to prove the server actually understands all aliases. ACKs for top commit: pierreN: Tested ACK fa168d7 tests, help messages Tree-SHA512: 05e15628e3a667b296f3783d20f764b450b959451b5360c7eaf5993156582d47a0f5882330ca2493b851eb46324d504953b90c875bc88a15c9e8c89eb3ef8d92
Diffstat (limited to 'src/rpc/util.h')
-rw-r--r--src/rpc/util.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/rpc/util.h b/src/rpc/util.h
index 11b806a0ff..53dce2c397 100644
--- a/src/rpc/util.h
+++ b/src/rpc/util.h
@@ -142,7 +142,7 @@ struct RPCArg {
OMITTED,
};
using Fallback = boost::variant<Optional, /* default value for optional args */ std::string>;
- const std::string m_name; //!< The name of the arg (can be empty for inner args)
+ const std::string m_names; //!< The name of the arg (can be empty for inner args, can contain multiple aliases separated by | for named request arguments)
const Type m_type;
const std::vector<RPCArg> m_inner; //!< Only used for arrays or dicts
const Fallback m_fallback;
@@ -157,7 +157,7 @@ struct RPCArg {
const std::string description,
const std::string oneline_description = "",
const std::vector<std::string> type_str = {})
- : m_name{std::move(name)},
+ : m_names{std::move(name)},
m_type{std::move(type)},
m_fallback{std::move(fallback)},
m_description{std::move(description)},
@@ -175,7 +175,7 @@ struct RPCArg {
const std::vector<RPCArg> inner,
const std::string oneline_description = "",
const std::vector<std::string> type_str = {})
- : m_name{std::move(name)},
+ : m_names{std::move(name)},
m_type{std::move(type)},
m_inner{std::move(inner)},
m_fallback{std::move(fallback)},
@@ -188,6 +188,12 @@ struct RPCArg {
bool IsOptional() const;
+ /** Return the first of all aliases */
+ std::string GetFirstName() const;
+
+ /** Return the name, throws when there are aliases */
+ std::string GetName() const;
+
/**
* Return the type string of the argument.
* Set oneline to allow it to be overridden by a custom oneline type string (m_oneline_description).