diff options
author | Brett Holman <bholman.devel@gmail.com> | 2021-12-06 15:27:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-06 15:27:12 -0700 |
commit | bedac77e9348e7a54c0ec364fb61df90cd893972 (patch) | |
tree | 73a0ddaada5ceb256e22c053fec50db82671d14c /doc/rtd | |
parent | f428ed1611bdb685598832dd42495f0bcda40ec4 (diff) | |
download | vyos-cloud-init-bedac77e9348e7a54c0ec364fb61df90cd893972.tar.gz vyos-cloud-init-bedac77e9348e7a54c0ec364fb61df90cd893972.zip |
Add Strict Metaschema Validation (#1101)
Improve schema validation.
This adds strict validation of config module definitions at testing
time, with plumbing included for future runtime validation. This
eliminates a class of bugs resulting from schemas that have definitions
that are incorrect, but get interpreted by jsonschema as
"additionalProperties" that are therefore ignored.
- Add strict meta-schema for jsonschema unit test validation
- Separate schema from module metadata structure
- Improve type annotations for various functions and data types
Cleanup:
- Remove unused jsonschema "required" elements
- Eliminate manual memoization in schema.py:get_schema(),
reference module.__doc__ directly
Diffstat (limited to 'doc/rtd')
-rw-r--r-- | doc/rtd/conf.py | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/doc/rtd/conf.py b/doc/rtd/conf.py index 684822c2..4316b5d9 100644 --- a/doc/rtd/conf.py +++ b/doc/rtd/conf.py @@ -1,6 +1,8 @@ import os import sys +from cloudinit import version + # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. @@ -9,8 +11,6 @@ sys.path.insert(0, os.path.abspath('../')) sys.path.insert(0, os.path.abspath('./')) sys.path.insert(0, os.path.abspath('.')) -from cloudinit import version -from cloudinit.config.schema import get_schema_doc # Supress warnings for docs that aren't used yet # unused_docs = [ @@ -66,12 +66,3 @@ html_theme = 'sphinx_rtd_theme' # The name of an image file (relative to this directory) to place at the top # of the sidebar. html_logo = 'static/logo.png' - -def generate_docstring_from_schema(app, what, name, obj, options, lines): - """Override module docs from schema when present.""" - if what == 'module' and hasattr(obj, "schema"): - del lines[:] - lines.extend(get_schema_doc(obj.schema).split('\n')) - -def setup(app): - app.connect('autodoc-process-docstring', generate_docstring_from_schema) |