Skip to content

Refactor & cleanup for public release#7

Merged
thevictorlopez merged 13 commits intomainfrom
refactor-cleanup
Mar 31, 2026
Merged

Refactor & cleanup for public release#7
thevictorlopez merged 13 commits intomainfrom
refactor-cleanup

Conversation

@thevictorlopez
Copy link
Copy Markdown
Contributor

Complete rework from the existing verision called "alpha (v4.0.0a1)" to v1.0.0. No backward compatibility with the previous API. Version numbers are now independent from the spec version. This implementation is based on the JS/TS reference implementation.

Breaking API changes

  • XARFParser and XARFGenerator classes removed, replaced by module-level functions parse(), create_report(), and create_evidence()
  • parse() and create_report() return ParseResult / CreateReportResult dataclasses. Validation errors and warnings are structured objects with field, message, and value instead of plain strings
  • minimum Python version raised from 3.8 to 3.10

Schema handling

  • All validation is now schema-driven via jsonschema + referencing (Draft 2020-12) against the official xarf-spec schemas. No hardcoded type or field lists anywhere
  • SchemaRegistry provides programmatic access to categories, types, and field metadata; SchemaValidator adds strict mode (promotes x-recommended fields to required before validation)
  • Schemas ship bundled in the wheel: python -m xarf fetch-schemas / check-schema-updates for explicit refresh

Tooling

  • Switched to ruff (replaces black, isort, flake8, and several others), mypy --strict, bandit, pre-commit and CI updated to match
  • Python test matrix updated to 3.10–3.13

Library, tests, and documentation

  • All 7 categories and all 32 report types implemented with Pydantic v2 discriminated union models. v3_compat type mappings aligned with the JS reference implementation
  • Test suite fully replaced. Driven by shared samples from tests/shared/
    • 80% coverage threshold enforced, no schema mocking
  • README, CHANGELOG, CONTRIBUTING, SECURITY, CODE_OF_CONDUCT all rewritten to be accurate and structurally parallel to the JS library. Stale/irrelevant docs deleted.
  • docs/MIGRATION_V3_TO_V4.md added
  • py.typed marker added

@thevictorlopez thevictorlopez merged commit c74efb3 into main Mar 31, 2026
5 checks passed
@thevictorlopez thevictorlopez deleted the refactor-cleanup branch March 31, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants