Skip to content

Commit

Permalink
feat(config): Add JSON schema
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Mar 28, 2024
1 parent 49e9eea commit 72594cd
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 2 deletions.
6 changes: 4 additions & 2 deletions config_example.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/gabe565/changelog-generator/main/internal/config/schema.json

# Sorts the changelog by the commit message.
# When empty, the order will match `git log`.
#
Expand All @@ -14,7 +16,7 @@ abbrev: 8
# Groups commits into sections.
# - title is the group heading.
# - order determines the sort order of the group.
# - regexp is matches against the first line of each commit.
# - regexp is matched against the first line of each commit.
groups:
- title: Features
order: 0
Expand All @@ -25,7 +27,7 @@ groups:
- title: Others
order: 999

# Divider is added between each group
# Divider that will be added between each group
#
# Default: empty
divider: "---"
Expand Down
65 changes: 65 additions & 0 deletions internal/config/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"additionalProperties": false,
"properties": {
"sort": {
"type": "string",
"enum": ["asc", "desc"],
"default": "asc",
"description": "Sorts the changelog by the commit message.\nWhen empty, the order will match `git log`."
},
"abbrev": {
"type": "integer",
"default": 8,
"description": "Shortens the commit hashes.\nIf set to -1, commit hashes will be excluded."
},
"groups": {
"type": "array",
"description": "Groups commits into sections.",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"title": {
"type": "string",
"description": "Group heading."
},
"order": {
"type": "integer",
"description": "Sort order of the group."
},
"regexp": {
"type": "string",
"description": "Regexp is matched against the first line of each commit."
}
}
}
},
"divider": {
"type": "string",
"description": "Divider that will be added between each group."
},
"filters": {
"type": "object",
"description": "Shows or hides commits. Each regexp is checked against the first commit message line only.",
"additionalProperties": false,
"properties": {
"exclude": {
"type": "array",
"description": "Regexp that will exclude matching commits from the changelog.",
"items": {
"type": "string"
}
},
"include": {
"type": "array",
"description": "Regexp that will include matching commits to the changelog. If set, exclude will be ignored.",
"items": {
"type": "string"
}
}
}
}
}
}

0 comments on commit 72594cd

Please sign in to comment.