From: Jan Hák Date: Mon, 24 Nov 2025 14:11:46 +0000 (+0100) Subject: knotc: add OPTINT in JSON schema of configuration file X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7474f06604194d7ca39d60a5ae8a40f528ebcd5;p=thirdparty%2Fknot-dns.git knotc: add OPTINT in JSON schema of configuration file --- diff --git a/src/knot/conf/base.c b/src/knot/conf/base.c index 04329bf672..5bc126d353 100644 --- a/src/knot/conf/base.c +++ b/src/knot/conf/base.c @@ -1175,7 +1175,28 @@ static void export_type(jsonw_t *w, const yp_item_t *item) ); break; case YP_TOPTINT: - // TODO + SINGLE_OR_ARRAY( + jsonw_list(w, "anyOf"); + jsonw_object(w, NULL); + jsonw_str(w, "$ref", "#/$defs/int"); + jsonw_end(w); + jsonw_object(w, NULL); + jsonw_str(w, "$ref", "#/$defs/int_time"); + jsonw_end(w); + jsonw_object(w, NULL); + jsonw_str(w, "$ref", "#/$defs/int_size"); + jsonw_end(w); + jsonw_object(w, NULL); + jsonw_str(w, "type", "string"); + jsonw_list(w, "enum"); + for (const knot_lookup_t *o = item->var.i.opts; + o->name != NULL; ++o) { + jsonw_str(w, NULL, o->name); + } + jsonw_end(w); + jsonw_end(w); + jsonw_end(w); + ); break; default: assert(0);