
org.kiwiproject.changelog.config.external.ExternalChangelogConfig.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of changelog-generator Show documentation
Show all versions of changelog-generator Show documentation
Generates GitHub change logs.
package org.kiwiproject.changelog.config.external
import com.fasterxml.jackson.annotation.JsonSetter
import com.fasterxml.jackson.annotation.Nulls.AS_EMPTY
// The JsonSetter is needed, otherwise null is the actual value when deserializing if there are no values in the YAML
data class ExternalChangelogConfig(
@JsonSetter(nulls = AS_EMPTY) val categories: List = listOf(),
) {
fun labelCategoryMap(): Map {
return categories
.flatMap { category -> category.labels.map { label -> LabelToCategory(label, category.name) } }
.associate { labelToCategory -> labelToCategory.label to labelToCategory.category }
}
private data class LabelToCategory(val label: String, val category: String)
fun categoryEmojiMap(): Map =
categories.associate { category -> category.name to category.emoji }
fun categoryOrder(): List = categories.map { it.name }
fun defaultCategory(): String? {
val categoryOrNull = categories.firstOrNull { it.isDefault }
return categoryOrNull?.name
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy