You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: json-schema-validator-objects/src/commonMain/kotlin/io/github/optimumcode/json/schema/wrappers/objects/Wrappers.kt
Copy file name to clipboardExpand all lines: json-schema-validator-objects/src/commonTest/kotlin/io/github/optimumcode/json/schema/wrappers/objects/WrappersTest.kt
+21-1Lines changed: 21 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,13 @@ class WrappersTest : FunSpec() {
26
26
fun Any?.str(): String=
27
27
when (this) {
28
28
isArray<*> ->this.contentToString()
29
+
isByteArray->this.contentToString()
30
+
isShortArray->this.contentToString()
31
+
isIntArray->this.contentToString()
32
+
isLongArray->this.contentToString()
33
+
isFloatArray->this.contentToString()
34
+
isDoubleArray->this.contentToString()
35
+
isCharArray->this.contentToString()
29
36
else-> toString()
30
37
}
31
38
@@ -35,7 +42,8 @@ class WrappersTest : FunSpec() {
35
42
emptyMap<String, Any>() to ObjectElement::class,
36
43
listOf<Any>() to ArrayElement::class,
37
44
emptyArray<Any>() to ArrayElement::class,
38
-
byteArrayOf() to ArrayElement::class,
45
+
// by default ByteArray is encoded as base64 string
46
+
byteArrayOf() to PrimitiveElement::class,
39
47
shortArrayOf() to ArrayElement::class,
40
48
intArrayOf() to ArrayElement::class,
41
49
longArrayOf() to ArrayElement::class,
@@ -297,6 +305,18 @@ class WrappersTest : FunSpec() {
297
305
wrapAsElement(MyNumber())
298
306
}.message.shouldStartWith("unsupported number type:")
299
307
}
308
+
309
+
test("byte array can be wrapped as an array element") {
0 commit comments