This PR restructures the Living Doc Generator to support multiple document types with dedicated schemas and templates. The changes move away from a monolithic pdf_ready_v1.0 schema to a modular architecture where each document type (User Stories, Coverage Matrix, UI Test Catalog) has its own schema, templates, and data structure.
Schema Restructuring:
- Replaced single
pdf_ready_v1.0-schema.jsonwith four document-specific schemas:coverage-matrix-v1.0.0-schema.jsondoc-source-v1.0.0-schema.json(User Stories)ui-tests-v1.0.0-schema.jsondoc-issues-v1.0.0-schema.json
Template Reorganization:
- Organized templates into document-type directories:
user-stories/- User stories, features, functionalitiescoverage-matrix/- Coverage matrix reportsui-test-catalog/- UI test documentation
Examples & Configuration:
- Consolidated examples into specific files:
coverage_matrix.json,ui_tests.json,user_stories.json,minimal.json - Updated
action.ymlto accept document-specific inputs - Updated
action_inputs.pyto parse multi-document workflows
Code Refactoring:
- Simplified
models.pydata structures for each document type - Enhanced
template_renderer.pyfor multi-document rendering - Removed
schema_export.py(schema tooling moved elsewhere) - Updated all unit and integration tests for new structure
Documentation:
- Added
docs/template-override-guide.mdfor template customization - Updated
DEVELOPER.mdwith new build and test instructions - Simplified
README.mdfor clarity
This modular approach enables:
- Independent schema versioning for each document type
- Cleaner code organization and maintainability
- Easier addition of new document types
- Better separation of concerns between templates
- More intuitive user experience with specific inputs per document type
# Run all tests
pytest tests/unit/generator/test_action_inputs.py -v
pytest tests/unit/generator/test_schema_validator.py -v
pytest tests/unit/generator/test_template_renderer.py -v
pytest tests/unit/generator/test_filters.py -v
# Code quality
black $(git ls-files '*.py')
pylint --ignore=tests $(git ls-files '*.py')
mypy .- Multi-document type support - Generate User Stories, Coverage Matrix, and UI Test Catalog independently
- Document-specific schemas v1.0.0 for each document type
- New template customization guide for overriding defaults
- Modular template system organized by document type
- Updated
action.ymlinputs for multi-document workflows - Data schema structure changed from
pdf_ready_v1.0to document-specific schemas - Template structure reorganized into subdirectories
- Example JSON files consolidated per document type
- Simplified and cleaner code organization
- Better maintainability with separated concerns
- Easier to extend with new document types
- Removed
schema_export.pymodule and legacy single-document handling
-
source-path now optional with deprecated alias support ✅
- Changed
source-pathtorequired: falsein action.yml - Backward compatibility maintained via pdf_ready_json alias
- Python-level validation enforces at least one must be provided
- Changed
-
JSON type validation ✅
- Added check to reject non-object JSON (arrays/scalars)
_load_json()now validates structure before returning- Improves error clarity for invalid inputs
-
Template base_dir asset resolution fixed ✅
- When both custom and built-in templates present, assets now resolve against built-in directory
- Allows partial template overrides without duplicating all assets
- Maintains fallback chain correctly
-
Markdown injection prevention ✅
- Relying on markdown library's default safe HTML handling
- Raw HTML in source is properly escaped
- Markdown formatting still works correctly
-
Debug HTML tests use production path ✅
- Extracted
_save_debug_html()helper in main.py - Tests now use production save logic instead of writing files directly
- Filename pattern verified:
{pdf_stem}_rendered.html
- Extracted
-
Schema-validated happy path test coverage ✅
- Added
test_generate_pdf_with_schema_validation()parametrized test - Validates each document type with bundled schema
- Tests schema-path plumbing end-to-end
- Added
- ✅ 61/61 unit tests passing (schema_validator, template_renderer, filters, models, action_inputs)
- All fixes validated without regressions
[commit 530e285]
- Multi-document restructuring complete
[CodeRabbit review fixes]
- Fixed 6 unresolved review comments
- Added JSON type validation, backward-compatible inputs, template asset resolution
- Improved debug HTML test coverage and markdown sanitization
- All 61 unit tests passing