Skip to content

docs: publish the style file JSON Schema at docs build - #60

Merged
aaronlippold merged 1 commit into
nextfrom
docs/fh9l7-style-json-schema
Nov 19, 2026
Merged

aaronlippold merged 1 commit into
nextfrom
docs/fh9l7-style-json-schema

Conversation

@aaronlippold

Copy link
Copy Markdown
Member

Publishes the JSON Schema of a style file at docs build, generated from StyleConfig, so a style author's editor can check a style file against the same schema cis-bench loads it with.

  • scripts/mkdocs_style_schema.py adds schemas/style.json (JSON Schema Draft 2020-12, with the $schema keyword) in on_files as a generated file, the way the benchmark schema is published; nothing is committed. Wired in mkdocs.yml.
  • yaml-config-reference.md links it and shows the two ways to point an editor at it (a # yaml-language-server: $schema=... comment, or yaml.schemas); the how-to for a new style mentions it in step 1. The schema covers one file's keys and values; the checks that need the XCCDF and Benchmark models run when cis-bench loads the style.
  • The shipped styles write rule_defaults.weight as text ("10.0"), which StyleConfig accepted but its generated schema refused. The model now declares weight as a number or decimal text, with one error for neither, so the published schema accepts what the loader accepts. A boolean weight and text that is no decimal ("nan", " 10 ") are now refused; no style writes them.

Verification: 2831 tests passed, tests/scripts 53, mypy, ruff, format, mkdocs build --strict; 28 XCCDF exports byte-identical to the exports before this change and valid.

Card: cis-bench-fh9l.7

A docs hook, scripts/mkdocs_style_schema.py, generates schemas/style.json
(JSON Schema Draft 2020-12) from StyleConfig in on_files as a generated
file, as the benchmark schema is published; no copy is committed. The
YAML config reference links it and shows how to point an editor at it
(yaml-language-server comment or yaml.schemas); the how-to for a new
style mentions it in its first step.

The shipped styles write rule_defaults.weight as text ("10.0"), which
StyleConfig accepted through lax float but its JSON Schema refused. The
model now declares weight as a number or decimal text, with one error
for neither, so the published schema accepts what the loader accepts.

Refs: cis-bench-fh9l.7
Signed-off-by: Aaron Lippold <lippold@gmail.com>
@aaronlippold
aaronlippold merged commit 46e67a9 into next Nov 19, 2026
7 checks passed
@aaronlippold
aaronlippold deleted the docs/fh9l7-style-json-schema branch November 19, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant