feat: add --api OpenAPI build mode with docs/api scheme and lib-prefixed nav

This commit is contained in:
2026-09-11 05:37:56 +05:30
parent 17e8628197
commit bacf17b930
26 changed files with 1404 additions and 174 deletions

View File

@@ -18,7 +18,7 @@ def test_mkdocs_build_full_flow(
(pkg / "mod.py").write_text("def f(): ...\n")
nav_file = cwd / "docforge.nav.yml"
nav_file.write_text("home: testpkg/index.md\ngroups: {}\n")
nav_file.write_text("home: lib/testpkg/index.md\ngroups: {}\n")
# We need to create a dummy testpkg/index.md for nav resolution if it's there
# But generate_sources will create it.
@@ -42,7 +42,7 @@ def test_mkdocs_build_full_flow(
assert mock_mkdocs_build() is True
assert (cwd / "mkdocs.yml").exists()
assert (cwd / "docs" / "lib" / "testpkg" / "mod.md").exists()
assert "docs_dir: docs/lib" in (cwd / "mkdocs.yml").read_text()
assert "docs_dir: docs" in (cwd / "mkdocs.yml").read_text()
def test_mkdocs_build_missing_module_fails(cli_runner):
@@ -69,7 +69,7 @@ def test_mkdocs_build_without_site_name_uses_module_as_default_full_flow(
# Create nav spec expected by generate_config
nav_file = cwd / "docforge.nav.yml"
nav_file.write_text(
"home: testpkg/index.md\ngroups: {}\n",
"home: lib/testpkg/index.md\ngroups: {}\n",
encoding="utf-8",
)