Skip to content

feat: JSON Schema for commitizen configuration (issue #1565) - #2067

Open
FreakyAdy wants to merge 3 commits into
commitizen-tools:masterfrom
FreakyAdy:feat/cz-json-schema
Open

feat: JSON Schema for commitizen configuration (issue #1565)#2067
FreakyAdy wants to merge 3 commits into
commitizen-tools:masterfrom
FreakyAdy:feat/cz-json-schema

Conversation

@FreakyAdy

Copy link
Copy Markdown

Implements a JSON Schema for the commitizen configuration ([tool.commitizen] section in pyproject.toml, or commitizen key in .cz.json/.cz.yaml).

Summary:

  • Generates schema from Settings and CzSettings TypedDicts in commitizen.defaults plus DEFAULT_SETTINGS runtime defaults
  • Script: scripts/gen_json_schema.py (run manually or via CI --check flag)
  • Committed schema: schemas/commitizen-config.schema.json (points to https://json.schemastore.org/commitizen.json for future schemastore.org release)
  • 18 tests in tests/test_json_schema.py validating generation, type mapping, defaults, and validation

Scope (per maintainer discussion in #1565):

  • Initial goal: release schema to schemastore.org so IDEs can auto-pick it up
  • Schema describes the commitizen section: [tool.commitizen] table in pyproject.toml (referenced with #:schema comment) or commitizen key in .cz.json/.cz.yaml (referenced with $schema key)
  • Covers all Settings keys + nested customize (CzSettings)
  • Unknown keys permitted (extras, future plugin settings)

Testing:

  • All 18 tests pass
  • uv run ruff check --fix . clean
  • uv run ruff format . clean
  • Full test suite green locally

Agent disclosure: This PR was developed with AI assistance (Hermes Agent).

…ools#1565)

- Add scripts/gen_json_schema.py: generates schema from Settings/CzSettings TypedDicts
- Add tests/test_json_schema.py: 18 tests validating schema generation, type mapping, defaults, and validation
- Add schemas/commitizen-config.schema.json: committed schema (schemastore.org-compatible)
- Update pyproject.toml: add jsonschema dependency to test group

The schema covers all config keys under [tool.commitizen] including nested customize.
All tests pass, ruff clean.
@codecov

codecov Bot commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.07%. Comparing base (93c7b51) to head (2b0b64b).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2067      +/-   ##
==========================================
+ Coverage   98.24%   99.07%   +0.82%     
==========================================
  Files          61       61              
  Lines        2799     2799              
==========================================
+ Hits         2750     2773      +23     
+ Misses         49       26      -23     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant