From: Vasek Sraier Date: Mon, 26 Sep 2022 11:21:32 +0000 (+0200) Subject: docs: generating and linking JSON schema for the declarative config X-Git-Tag: v6.0.0a1~12^2~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45a7e8edd3ff537dea34f80f733e5cc69f3200cd;p=thirdparty%2Fknot-resolver.git docs: generating and linking JSON schema for the declarative config --- diff --git a/.gitignore b/.gitignore index d4522a87b..a138c926b 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,7 @@ /doc/html /doc/kresd.8 /doc/texinfo +/doc/_static/config-schema.json /ephemeral_key.pem /install-sh /libkres.pc diff --git a/doc/gettingstarted-config.rst b/doc/gettingstarted-config.rst index a2b4bc574..75101d410 100644 --- a/doc/gettingstarted-config.rst +++ b/doc/gettingstarted-config.rst @@ -18,8 +18,8 @@ The example configuration files are also installed as documentation files, typic .. tip:: - An easy way to see the complete configuration structure is to look at the `JSON Schema `_ on `http://localhost:5000/schema/ui `_ with the Knot Resolver running. - The raw schema is availiable on `http://localhost:5000/schema `_. + An easy way to see the complete configuration structure is to look at the `JSON Schema `_ of the configuration format with some graphical visualizer such as `this one `_. + The raw schema is accessible from every running Knot Resolver at the HTTP API socket at path ``/schema`` or on `this link <_static/config-schema.json>`_ (valid only for the version of resolver this documentation was generated for) =================== Management HTTP API diff --git a/doc/meson.build b/doc/meson.build index 29e6faf93..482c4701a 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -80,14 +80,30 @@ if get_option('doc') == 'enabled' endif endif + +python3 = find_program('python3') +json_schema = custom_target( + 'doc-json-schema', + command: [python3, '-m', 'manager.knot_resolver_manager.cli', 'schema', 'docs/_static/config-schema.json'], + input: [ + + ], + output: [ + 'docs/_static/config-schema.json' + ] +) + + make_doc = find_program('../scripts/make-doc.sh') run_target( 'doc', command: make_doc, + depends: [json_schema], ) run_target( 'doc-strict', command: [make_doc, '-W'], + depends: [json_schema], ) diff --git a/scripts/make-doc.sh b/scripts/make-doc.sh index d41e234c9..086fe4103 100755 --- a/scripts/make-doc.sh +++ b/scripts/make-doc.sh @@ -2,6 +2,15 @@ # SPDX-License-Identifier: GPL-3.0-or-later cd "$(dirname ${0})/.." + +# generate JSON schema for the manager's declarative config +pushd manager +## the following python command should hopefully run without any dependencies except for standard python +mkdir -p ../doc/_static/ +python3 -m knot_resolver_manager.cli schema > ../doc/_static/config-schema.json +popd + + pushd doc doxygen popd