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 <rusty@rustcorp.com.au>

```
     - `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`)
```
This commit is contained in:
Rusty Russell 2024-08-15 16:35:32 +09:30
parent 054eeb8aa2
commit 9a6325c4f3

View File

@ -1581,6 +1581,14 @@ static const char *fmt_indexes(const tal_t *ctx, const char *table)
return tal_fmt(ctx, " indexed by `%s`", ret);
}
static const char *json_prefix(const tal_t *ctx,
const struct table_desc *td)
{
if (td->is_subobject)
return tal_fmt(ctx, "%s%s.", json_prefix(tmpctx, td->parent), td->cmdname);
return "";
}
static void print_columns(const struct table_desc *td, const char *indent,
const char *objsrc)
{
@ -1603,7 +1611,8 @@ static void print_columns(const struct table_desc *td, const char *indent,
const char *subobjsrc;
subobjsrc = tal_fmt(tmpctx,
", from JSON object `%s`",
", from JSON object `%s%s`",
json_prefix(tmpctx, td),
td->columns[i]->jsonname);
print_columns(subtd, indent, subobjsrc);
}
@ -1613,7 +1622,8 @@ static void print_columns(const struct table_desc *td, const char *indent,
if (streq(objsrc, "")
&& td->columns[i]->jsonname
&& !streq(td->columns[i]->dbname, td->columns[i]->jsonname)) {
origin = tal_fmt(tmpctx, ", from JSON field `%s`",
origin = tal_fmt(tmpctx, ", from JSON field `%s%s`",
json_prefix(tmpctx, td),
td->columns[i]->jsonname);
} else
origin = "";