]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
docs: generating and linking JSON schema for the declarative config
authorVasek Sraier <git@vakabus.cz>
Mon, 26 Sep 2022 11:21:32 +0000 (13:21 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Tue, 10 Jan 2023 18:57:13 +0000 (19:57 +0100)
.gitignore
doc/gettingstarted-config.rst
doc/meson.build
scripts/make-doc.sh

index d4522a87b1541bc4718419273fd0f1d123e358f3..a138c926b7d9c0fad1f68a789560abd663f7f14d 100644 (file)
@@ -51,6 +51,7 @@
 /doc/html
 /doc/kresd.8
 /doc/texinfo
+/doc/_static/config-schema.json
 /ephemeral_key.pem
 /install-sh
 /libkres.pc
index a2b4bc5744e465b6d77889f23266620baa8094cc..75101d410d8acb4fb3d4c029f5c4164646abfa65 100644 (file)
@@ -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 <https://json-schema.org/>`_ on `http://localhost:5000/schema/ui <http://localhost:5000/schema/ui>`_ with the Knot Resolver running.
-    The raw schema is availiable on `http://localhost:5000/schema <http://localhost:5000/schema>`_.
+    An easy way to see the complete configuration structure is to look at the `JSON Schema <https://json-schema.org/>`_ of the configuration format with some graphical visualizer such as `this one <https://json-schema.app/>`_.
+    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
index 29e6faf93adaf673f6aa258aefc41923dcfe0e3a..482c4701a8dfe584b49489cf5e511b16ed46db46 100644 (file)
@@ -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],
 )
index d41e234c938d159530f4b7058af8cf07cf1a21a5..086fe4103184e8e02b0e29c59bc2329416c8b15f 100755 (executable)
@@ -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