From 0b48dd79ac2516f8bea51336d35cab87a87754a9 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 26 May 2021 15:21:01 +0930 Subject: [PATCH] doc/schemas: add schema for autoclean. Signed-off-by: Rusty Russell --- doc/lightning-autocleaninvoice.7 | 19 +++++++++-- doc/lightning-autocleaninvoice.7.md | 10 +++++- doc/schemas/autocleaninvoice.schema.json | 41 ++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 doc/schemas/autocleaninvoice.schema.json diff --git a/doc/lightning-autocleaninvoice.7 b/doc/lightning-autocleaninvoice.7 index fcbf233e4..0c9dfead0 100644 --- a/doc/lightning-autocleaninvoice.7 +++ b/doc/lightning-autocleaninvoice.7 @@ -25,8 +25,23 @@ On startup of the daemon, no autoclean is set up\. .SH RETURN VALUE -On success, an empty object is returned\. +On success, an object is returned, containing: +.RS +.IP \[bu] +\fBenabled\fR (boolean): whether invoice autocleaning is active + +.RE + +If \fBenabled\fR is \fItrue\fR: + +.RS +.IP \[bu] +\fBexpired_by\fR (u64): how long an invoice must be expired (seconds) before we delete it +.IP \[bu] +\fBcycle_seconds\fR (u64): how long an invoice must be expired (seconds) before we delete it + +.RE .SH AUTHOR ZmnSCPxj \fI is mainly responsible\. @@ -39,4 +54,4 @@ ZmnSCPxj \fI is mainly responsible\. Main web site: \fIhttps://github.com/ElementsProject/lightning\fR -\" SHA256STAMP:df05ece680710d67202b28af635a274d7adc38d9f334c79d88ee28b80a2cae60 +\" SHA256STAMP:dd3f512e81f45ab6084b608bc05fba5679b1d20d493aad98d422bdf593182604 diff --git a/doc/lightning-autocleaninvoice.7.md b/doc/lightning-autocleaninvoice.7.md index d741fa433..6e649ee2f 100644 --- a/doc/lightning-autocleaninvoice.7.md +++ b/doc/lightning-autocleaninvoice.7.md @@ -25,7 +25,14 @@ On startup of the daemon, no autoclean is set up. RETURN VALUE ------------ -On success, an empty object is returned. +[comment]: # (GENERATE-FROM-SCHEMA-START) +On success, an object is returned, containing: +- **enabled** (boolean): whether invoice autocleaning is active + +If **enabled** is *true*: + - **expired_by** (u64): how long an invoice must be expired (seconds) before we delete it + - **cycle_seconds** (u64): how long an invoice must be expired (seconds) before we delete it +[comment]: # (GENERATE-FROM-SCHEMA-END) AUTHOR ------ @@ -42,3 +49,4 @@ RESOURCES Main web site: +[comment]: # ( SHA256STAMP:2accf7788133af97ae097f7e4e8a80b35bbb431eb7e787e5ae12dd5c7d2c296d) diff --git a/doc/schemas/autocleaninvoice.schema.json b/doc/schemas/autocleaninvoice.schema.json new file mode 100644 index 000000000..7ed3db3d5 --- /dev/null +++ b/doc/schemas/autocleaninvoice.schema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": true, + "required": [ "enabled" ], + "properties": { + "enabled": { + "type": "boolean", + "description": "whether invoice autocleaning is active" + } + }, + "if": { + "properties": { + "enabled": { + "type": "boolean", + "enum": [ true ] + } + } + }, + "then": { + "additionalProperties": false, + "required": [ "expired_by", "cycle_seconds" ], + "properties": { + "enabled": { }, + "expired_by": { + "type": "u64", + "description": "how long an invoice must be expired (seconds) before we delete it" + }, + "cycle_seconds": { + "type": "u64", + "description": "how long an invoice must be expired (seconds) before we delete it" + } + } + }, + "else": { + "additionalProperties": false, + "properties": { + "enabled": { } + } + } +}