@@ -7,20 +7,24 @@ import io.kotest.assertions.throwables.shouldThrow
7
7
import io.kotest.core.spec.style.FunSpec
8
8
import io.kotest.matchers.collections.shouldHaveSize
9
9
import io.kotest.matchers.shouldBe
10
+ import kotlinx.serialization.ExperimentalSerializationApi
10
11
import kotlinx.serialization.json.JsonNull
11
12
import kotlinx.serialization.json.JsonPrimitive
13
+ import kotlinx.serialization.json.JsonUnquotedLiteral
12
14
import kotlinx.serialization.json.buildJsonArray
13
15
import kotlinx.serialization.json.buildJsonObject
14
16
17
+ // JsonUnquotedLiteral is used to bypass the JS conversion to integer value
18
+ @OptIn(ExperimentalSerializationApi ::class )
15
19
@Suppress(" unused" )
16
20
class JsonSchemaMultipleOfValidationTest : FunSpec () {
17
21
init {
18
22
listOf (
19
23
JsonPrimitive (7 ),
20
24
JsonPrimitive (49 ),
21
- JsonPrimitive ( 49.0 ),
25
+ JsonUnquotedLiteral ( " 49.0" ),
22
26
JsonPrimitive (- 49 ),
23
- JsonPrimitive ( - 49.0 ),
27
+ JsonUnquotedLiteral ( " -49.0" ),
24
28
).forEach {
25
29
val schema = JsonSchema .fromDescription(
26
30
"""
@@ -40,10 +44,10 @@ class JsonSchemaMultipleOfValidationTest : FunSpec() {
40
44
41
45
listOf (
42
46
JsonPrimitive (3 ),
43
- JsonPrimitive ( 3.0 ),
47
+ JsonUnquotedLiteral ( " 3.0" ),
44
48
JsonPrimitive (4.5 ),
45
49
JsonPrimitive (- 3 ),
46
- JsonPrimitive ( - 3.0 ),
50
+ JsonUnquotedLiteral ( " -3.0" ),
47
51
JsonPrimitive (- 4.5 ),
48
52
).forEach {
49
53
val schema = JsonSchema .fromDescription(
@@ -64,9 +68,9 @@ class JsonSchemaMultipleOfValidationTest : FunSpec() {
64
68
65
69
listOf (
66
70
JsonPrimitive (0 ),
67
- JsonPrimitive ( 0.0 ),
71
+ JsonUnquotedLiteral ( " 0.0" ),
68
72
JsonPrimitive (- 1 ),
69
- JsonPrimitive ( - 1.0 ),
73
+ JsonUnquotedLiteral ( " -1.0" ),
70
74
JsonPrimitive (- Double .MAX_VALUE ),
71
75
JsonPrimitive (Long .MIN_VALUE ),
72
76
).forEach {
0 commit comments