@@ -7,20 +7,24 @@ import io.kotest.assertions.throwables.shouldThrow
77import io.kotest.core.spec.style.FunSpec
88import io.kotest.matchers.collections.shouldHaveSize
99import io.kotest.matchers.shouldBe
10+ import kotlinx.serialization.ExperimentalSerializationApi
1011import kotlinx.serialization.json.JsonNull
1112import kotlinx.serialization.json.JsonPrimitive
13+ import kotlinx.serialization.json.JsonUnquotedLiteral
1214import kotlinx.serialization.json.buildJsonArray
1315import kotlinx.serialization.json.buildJsonObject
1416
17+ // JsonUnquotedLiteral is used to bypass the JS conversion to integer value
18+ @OptIn(ExperimentalSerializationApi ::class )
1519@Suppress(" unused" )
1620class JsonSchemaMultipleOfValidationTest : FunSpec () {
1721 init {
1822 listOf (
1923 JsonPrimitive (7 ),
2024 JsonPrimitive (49 ),
21- JsonPrimitive ( 49.0 ),
25+ JsonUnquotedLiteral ( " 49.0" ),
2226 JsonPrimitive (- 49 ),
23- JsonPrimitive ( - 49.0 ),
27+ JsonUnquotedLiteral ( " -49.0" ),
2428 ).forEach {
2529 val schema = JsonSchema .fromDescription(
2630 """
@@ -40,10 +44,10 @@ class JsonSchemaMultipleOfValidationTest : FunSpec() {
4044
4145 listOf (
4246 JsonPrimitive (3 ),
43- JsonPrimitive ( 3.0 ),
47+ JsonUnquotedLiteral ( " 3.0" ),
4448 JsonPrimitive (4.5 ),
4549 JsonPrimitive (- 3 ),
46- JsonPrimitive ( - 3.0 ),
50+ JsonUnquotedLiteral ( " -3.0" ),
4751 JsonPrimitive (- 4.5 ),
4852 ).forEach {
4953 val schema = JsonSchema .fromDescription(
@@ -64,9 +68,9 @@ class JsonSchemaMultipleOfValidationTest : FunSpec() {
6468
6569 listOf (
6670 JsonPrimitive (0 ),
67- JsonPrimitive ( 0.0 ),
71+ JsonUnquotedLiteral ( " 0.0" ),
6872 JsonPrimitive (- 1 ),
69- JsonPrimitive ( - 1.0 ),
73+ JsonUnquotedLiteral ( " -1.0" ),
7074 JsonPrimitive (- Double .MAX_VALUE ),
7175 JsonPrimitive (Long .MIN_VALUE ),
7276 ).forEach {
0 commit comments