Skip to content

Commit 9a6325c

Browse files
committed
doc: properly document sub-subobject fields.
Inside listpeerchannels, there's an object called `updates`, and inside that objects `local` and `remote`. We flatten this, but the documentation doesn't mention the `updates` field at all. Ideally we would rename these fields to include `updates_` but that would be a breaking change. Signed-off-by: Rusty Russell <[email protected]> ``` - `row` (reference to `peerchannels_channel_type.rowid`, sqltype `INTEGER`) - `arrindex` (index within array, sqltype `INTEGER`) - `names` (type `string`, sqltype `TEXT`) - - `local_htlc_minimum_msat` (type `msat`, sqltype `INTEGER`, from JSON object `local`) - - `local_htlc_maximum_msat` (type `msat`, sqltype `INTEGER`, from JSON object `local`) - - `local_cltv_expiry_delta` (type `u32`, sqltype `INTEGER`, from JSON object `local`) - - `local_fee_base_msat` (type `msat`, sqltype `INTEGER`, from JSON object `local`) - - `local_fee_proportional_millionths` (type `u32`, sqltype `INTEGER`, from JSON object `local`) - - `remote_htlc_minimum_msat` (type `msat`, sqltype `INTEGER`, from JSON object `remote`) - - `remote_htlc_maximum_msat` (type `msat`, sqltype `INTEGER`, from JSON object `remote`) - - `remote_cltv_expiry_delta` (type `u32`, sqltype `INTEGER`, from JSON object `remote`) - - `remote_fee_base_msat` (type `msat`, sqltype `INTEGER`, from JSON object `remote`) - - `remote_fee_proportional_millionths` (type `u32`, sqltype `INTEGER`, from JSON object `remote`) + - `local_htlc_minimum_msat` (type `msat`, sqltype `INTEGER`, from JSON object `updates.local`) + - `local_htlc_maximum_msat` (type `msat`, sqltype `INTEGER`, from JSON object `updates.local`) + - `local_cltv_expiry_delta` (type `u32`, sqltype `INTEGER`, from JSON object `updates.local`) + - `local_fee_base_msat` (type `msat`, sqltype `INTEGER`, from JSON object `updates.local`) + - `local_fee_proportional_millionths` (type `u32`, sqltype `INTEGER`, from JSON object `updates.local`) + - `remote_htlc_minimum_msat` (type `msat`, sqltype `INTEGER`, from JSON object `updates.remote`) + - `remote_htlc_maximum_msat` (type `msat`, sqltype `INTEGER`, from JSON object `updates.remote`) + - `remote_cltv_expiry_delta` (type `u32`, sqltype `INTEGER`, from JSON object `updates.remote`) + - `remote_fee_base_msat` (type `msat`, sqltype `INTEGER`, from JSON object `updates.remote`) + - `remote_fee_proportional_millionths` (type `u32`, sqltype `INTEGER`, from JSON object `updates.remote`) - `ignore_fee_limits` (type `boolean`, sqltype `INTEGER`) - `lost_state` (type `boolean`, sqltype `INTEGER`) - `feerate_perkw` (type `u32`, sqltype `INTEGER`, from JSON object `feerate`) ```
1 parent 054eeb8 commit 9a6325c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

plugins/sql.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,14 @@ static const char *fmt_indexes(const tal_t *ctx, const char *table)
15811581
return tal_fmt(ctx, " indexed by `%s`", ret);
15821582
}
15831583

1584+
static const char *json_prefix(const tal_t *ctx,
1585+
const struct table_desc *td)
1586+
{
1587+
if (td->is_subobject)
1588+
return tal_fmt(ctx, "%s%s.", json_prefix(tmpctx, td->parent), td->cmdname);
1589+
return "";
1590+
}
1591+
15841592
static void print_columns(const struct table_desc *td, const char *indent,
15851593
const char *objsrc)
15861594
{
@@ -1603,7 +1611,8 @@ static void print_columns(const struct table_desc *td, const char *indent,
16031611
const char *subobjsrc;
16041612

16051613
subobjsrc = tal_fmt(tmpctx,
1606-
", from JSON object `%s`",
1614+
", from JSON object `%s%s`",
1615+
json_prefix(tmpctx, td),
16071616
td->columns[i]->jsonname);
16081617
print_columns(subtd, indent, subobjsrc);
16091618
}
@@ -1613,7 +1622,8 @@ static void print_columns(const struct table_desc *td, const char *indent,
16131622
if (streq(objsrc, "")
16141623
&& td->columns[i]->jsonname
16151624
&& !streq(td->columns[i]->dbname, td->columns[i]->jsonname)) {
1616-
origin = tal_fmt(tmpctx, ", from JSON field `%s`",
1625+
origin = tal_fmt(tmpctx, ", from JSON field `%s%s`",
1626+
json_prefix(tmpctx, td),
16171627
td->columns[i]->jsonname);
16181628
} else
16191629
origin = "";

0 commit comments

Comments
 (0)