]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
docs: Generate schema files also when using Meson
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 4 Feb 2026 12:51:09 +0000 (13:51 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Mon, 23 Mar 2026 09:34:54 +0000 (10:34 +0100)
.github/actions/spell-check/expect.txt
docs/generate-jsonschema.py
meson.build
pdns/recursordist/meson.build

index 30560e2d9519c3865e6be50f32c5dbe00e15819f..43f0d78ea8987f1b6a2a85878db89d329fdb2237 100644 (file)
@@ -1349,6 +1349,7 @@ srv
 sshfp
 SSQ
 stacksize
+stampfile
 starttransaction
 Stasic
 statbag
index db4077292ee64c1a61cb019fc26ca9b1ac4b43ec..abbaccfe3a8f7b8089f1881bc2b8220a89ae1e53 100755 (executable)
@@ -1,14 +1,14 @@
 #!/usr/bin/env python3
 
-import yaml
 import argparse
-
-from typing import Dict, Any, overload, cast
 from collections.abc import Mapping
+from pathlib import Path
+from typing import Any, Dict, cast, overload
 
-# This function was taken (and slightly modified) from https://github.com/instrumenta/openapi2jsonschema
+import yaml
 
 
+# This function was taken (and slightly modified) from https://github.com/instrumenta/openapi2jsonschema
 # overload function signatures for different input types
 @overload
 def change_dict_values(
@@ -77,6 +77,7 @@ def main():
     ap = argparse.ArgumentParser()
     ap.add_argument("infile", type=str)
     ap.add_argument("outfile", type=str)
+    ap.add_argument("--stampfile", type=str)
     args = ap.parse_args()
 
     data: dict | None = None
@@ -95,6 +96,9 @@ def main():
     with open(args.outfile, "w") as w:
         yaml.safe_dump(out, w)
 
+    if args.stampfile:
+        Path.touch(args.stampfile)
+
 
 if __name__ == "__main__":
     main()
index adf85ac57f2515da0b84808a1a7b14ec79aae873..c144041294b01bc22f68ad32f9ea9160376f02d7 100644 (file)
@@ -1180,6 +1180,20 @@ if get_option('unit-tests-backends')
 endif
 
 if python.found()
+  json_schema = custom_target(
+    'auth-json-schema',
+    input: product_source_dir / docs_dir / 'http-api' / 'swagger' / 'authoritative-api-swagger.yaml',
+    output: 'auth-schema-generated.stamp',
+    command: [
+      python,
+      product_source_dir / docs_dir / 'generate-jsonschema.py',
+      '@INPUT@',
+      product_source_dir / docs_dir / 'http-api' / 'swagger' / 'authoritative-api-schema.yaml',
+      '--stampfile',
+      '@OUTPUT@'
+    ],
+  )
+
   html_docs = custom_target(
     'html-docs',
     command: [
@@ -1195,6 +1209,7 @@ if python.found()
     output: 'sphinx.stamp',
     console: true,
     depfile: 'sphinx.d',
+    depends: [json_schema],
   )
 
   docs_tarball = custom_target(
@@ -1218,6 +1233,7 @@ if python.found()
     output: 'PowerDNS-Authoritative.pdf',
     console: true,
     depfile: 'sphinx.d',
+    depends: [json_schema],
   )
 
   run_target(
index b393b762bd0a77ada643da32f698c35706eb4047..14906e5ec80da5283b1ea6f3851aa84484cc0b32 100644 (file)
@@ -779,6 +779,19 @@ dep_conf_distfile = custom_target(
 )
 
 if python.found()
+  json_schema = custom_target(
+    'recursor-json-schema',
+    input: product_source_dir / docs_dir / 'http-api' / 'authoritative-api-swagger.yaml',
+    output: 'rec-schema-generated.stamp',
+    command: [
+      python,
+      product_source_dir / docs_dir / 'generate-jsonschema.py',
+      '@INPUT@',
+      product_source_dir / docs_dir / 'http-api' / 'recursor-generated-schema.yaml',
+      '--stampfile',
+      '@OUTPUT@'
+    ],
+  )
 
   html_docs = custom_target(
     'html-docs',
@@ -795,7 +808,7 @@ if python.found()
     output: 'sphinx.stamp',
     console: true,
     depfile: 'sphinx.d',
-    depends: [ metricfiles, recrust ], # for generated .rst files
+    depends: [ metricfiles, recrust, json_schema ], # for generated .rst files
   )
 
   docs_tarball = custom_target(