diff --git a/CHANGELOG.md b/CHANGELOG.md index ac397dcd0..6ad66e1a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.9.0] - october 15th, 2021 + +### Added + +- ByteArray added to the set of default types + + ## [1.8.1] - October 4th, 2021 ### Added diff --git a/gradle.properties b/gradle.properties index 9f2e64eee..b5650987d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Kompendium -project.version=1.8.1 +project.version=1.9.0 # Kotlin kotlin.code.style=official # Gradle diff --git a/kompendium-core/src/main/kotlin/io/bkbn/kompendium/Kontent.kt b/kompendium-core/src/main/kotlin/io/bkbn/kompendium/Kontent.kt index 76059f24d..df8a309d4 100644 --- a/kompendium-core/src/main/kotlin/io/bkbn/kompendium/Kontent.kt +++ b/kompendium-core/src/main/kotlin/io/bkbn/kompendium/Kontent.kt @@ -127,6 +127,7 @@ object Kontent { UUID::class -> cache.plus(clazz.simpleName!! to FormatSchema("uuid", "string")) BigDecimal::class -> cache.plus(clazz.simpleName!! to FormatSchema("double", "number")) BigInteger::class -> cache.plus(clazz.simpleName!! to FormatSchema("int64", "integer")) + ByteArray::class -> cache.plus(clazz.simpleName!! to FormatSchema("byte", "string")) else -> when { clazz.isSubclassOf(Collection::class) -> handleCollectionType(type, clazz, cache) clazz.isSubclassOf(Enum::class) -> handleEnumType(clazz, cache) diff --git a/kompendium-core/src/test/kotlin/io/bkbn/kompendium/KontentTest.kt b/kompendium-core/src/test/kotlin/io/bkbn/kompendium/KontentTest.kt index 2084110eb..13da2c6f2 100644 --- a/kompendium-core/src/test/kotlin/io/bkbn/kompendium/KontentTest.kt +++ b/kompendium-core/src/test/kotlin/io/bkbn/kompendium/KontentTest.kt @@ -49,6 +49,17 @@ internal class KontentTest { assertEquals(FormatSchema("int64", "integer"), result["BigInteger"]) } + @Test + fun `Object with ByteArray type`() { + // do + val result = generateKontent() + + // expect + assertEquals(2, result.count()) + assertTrue { result.containsKey(TestByteArrayModel::class.simpleName) } + assertEquals(FormatSchema("byte", "string"), result["ByteArray"]) + } + @Test fun `Objects reference their base types in the cache`() { // do diff --git a/kompendium-core/src/test/kotlin/io/bkbn/kompendium/util/TestModels.kt b/kompendium-core/src/test/kotlin/io/bkbn/kompendium/util/TestModels.kt index 3eab02493..f0002f690 100644 --- a/kompendium-core/src/test/kotlin/io/bkbn/kompendium/util/TestModels.kt +++ b/kompendium-core/src/test/kotlin/io/bkbn/kompendium/util/TestModels.kt @@ -12,6 +12,8 @@ data class TestSimpleModel(val a: String, val b: Int) data class TestBigNumberModel(val a: BigDecimal, val b: BigInteger) +data class TestByteArrayModel(val a: ByteArray) + data class TestNestedModel(val inner: TestSimpleModel) data class TestSimpleWithEnums(val a: String, val b: SimpleEnum)