commitizen icon indicating copy to clipboard operation
commitizen copied to clipboard

JSON Schema File

Open DanzigerGeist opened this issue 5 months ago • 2 comments

Description

Would it be possible to host a JSON schema for the cz.json configuration file in order to enable the syntax checks?

For example, in Deno projects we add the following field to deno.json file:

"$schema": "https://deno.land/x/deno/cli/schemas/config-file.v1.json"

This could be extremely useful for configuration checks and validation.

Possible Solution

No response

Additional context

No response

Related issues

No response

DanzigerGeist avatar Aug 04 '25 11:08 DanzigerGeist

I'm not sure I'm a fan of adding this check 🤔 It does not look like a standard thing. (or maybe I'm wrong) Would love to hear what @woile and @noirbizarre think

Lee-W avatar Aug 06 '25 02:08 Lee-W

I think it's a good idea. A JSON Schema works for other formats, including toml. We would have to create the schema based on the default setting class and just host it in our website. Then you just reference it as a comment in toml or with $schema key in JSON. Tools like pydantic generate the json schema right away from a base model for example. In our case, we would have to write some inference code, but it should be possible.

It's a very interesting issue if someone wants to pick it up.

woile avatar Aug 06 '25 07:08 woile