Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 108 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ pre-release-replacements = [
winnow = "0.7.0"
unicase = "2.5"
serde = { version = "1.0.163", optional = true, features = ["derive"] }
schemars = { version = "1.0.4", optional = true }

[dev-dependencies]
indoc = "2.0"
Expand Down
9 changes: 8 additions & 1 deletion src/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const BREAKING_ARROW: &str = "BREAKING-CHANGE";

/// A conventional commit.
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Commit<'a> {
ty: Type<'a>,
Expand Down Expand Up @@ -149,6 +150,7 @@ impl fmt::Display for Commit<'_> {
///
/// See: <https://git-scm.com/docs/git-interpret-trailers>
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
pub struct Footer<'a> {
token: FooterToken<'a>,
Expand Down Expand Up @@ -192,6 +194,7 @@ impl fmt::Display for Footer<'_> {

/// The type of separator between the footer token and value.
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
#[non_exhaustive]
pub enum FooterSeparator {
Expand Down Expand Up @@ -251,7 +254,11 @@ macro_rules! unicase_components {
$(
/// A component of the conventional commit.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct $ty<'a>(unicase::UniCase<&'a str>);
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct $ty<'a>(
#[cfg_attr(feature = "schemars", schemars(with = "String"))]
unicase::UniCase<&'a str>
);

impl<'a> $ty<'a> {
/// See `parse` for ensuring the data is valid.
Expand Down