git-conventional icon indicating copy to clipboard operation
git-conventional copied to clipboard

feat: add schemars feature

Open greenhat616 opened this issue 2 months ago • 4 comments

Support dump json schema for downstream crates

greenhat616 avatar Oct 24 '25 07:10 greenhat616

Note that our contribution process encourages people to start with issues before posting PRs to make sure we have alignment on the problem and the solution, see https://github.com/crate-ci/git-conventional/blob/master/CONTRIBUTING.md#pull-requests

I am hesitant to take on schemars as a public feature / dependency but maybe now that its 1.0, it will be ok.

I very much want to see where orhun/git-cliff#1294 goes before considering merging this.

epage avatar Oct 27 '25 19:10 epage

I left some comment:

https://github.com/orhun/git-cliff/pull/1296#pullrequestreview-3391829021

ognis1205 avatar Oct 29 '25 06:10 ognis1205

Sorry about that—I didn’t think it through enough. I originally saw this as a small improvement, so I didn’t open an issue first.

Given that the structs provided by git-conventional are relatively simple, defining Remote via schemars is a workable approach. The concrete steps will depend on how our Cliff PR progresses.

By the way, schemars has indeed reached 1.0 :D

greenhat616 avatar Oct 29 '25 12:10 greenhat616

Given that, adding schema-generation logic directly into the CLI might slightly drift away from the core purpose of git-cliff, which is primarily a changelog generator.

Similarly, this is drifting from the core purpose of this crate, a parser. It was a stretch already for add serde support (#7) and each time I see it brought up, I question its existence. We make no guarentees about the shape of the types we provide and people putting that in their public APIs comes at a risk. It would generally be better for people to copy into the types that they care about in a shape they define.

epage avatar Oct 29 '25 15:10 epage