File tree Expand file tree Collapse file tree 2 files changed +3
-16
lines changed Expand file tree Collapse file tree 2 files changed +3
-16
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import io.github.optimumcode.json.schema.JsonSchema
3
3
import io.github.optimumcode.json.schema.JsonSchemaLoader
4
4
import io.github.optimumcode.json.schema.SchemaType
5
5
import kotlinx.serialization.encodeToString
6
+ import kotlinx.serialization.json.ClassDiscriminatorMode
6
7
import kotlinx.serialization.json.Json
7
8
import kotlinx.serialization.json.JsonElement
8
9
import kotlinx.serialization.json.JsonObject
@@ -21,6 +22,7 @@ fun main() {
21
22
ignoreUnknownKeys = true
22
23
prettyPrint = false
23
24
encodeDefaults = true
25
+ classDiscriminatorMode = ClassDiscriminatorMode .NONE
24
26
}
25
27
val processor = BowtieSampsonSchemaValidatorLauncher (outputWriter, json)
26
28
input.lines().forEach {
Original file line number Diff line number Diff line change 1
- import kotlinx.serialization.DeserializationStrategy
2
1
import kotlinx.serialization.Serializable
3
- import kotlinx.serialization.json.JsonContentPolymorphicSerializer
4
2
import kotlinx.serialization.json.JsonElement
5
- import kotlinx.serialization.json.JsonObject
6
3
7
4
@Serializable
8
5
class StartResponse (
@@ -55,7 +52,7 @@ sealed class RunResponse {
55
52
) : RunResponse()
56
53
}
57
54
58
- @Serializable(with = TestResultSerializer :: class )
55
+ @Serializable
59
56
sealed class TestResult {
60
57
61
58
@Serializable
@@ -82,15 +79,3 @@ class ErrorContext(
82
79
val traceback : String? = null ,
83
80
val stderr : String? = null ,
84
81
)
85
-
86
- private class TestResultSerializer : JsonContentPolymorphicSerializer <TestResult >(TestResult : :class) {
87
- override fun selectDeserializer (element : JsonElement ): DeserializationStrategy <TestResult > {
88
- require(element is JsonObject ) { " command must be an object" }
89
- return when {
90
- " valid" in element -> TestResult .Executed .serializer()
91
- " skipped" in element -> TestResult .Skipped .serializer()
92
- " errored" in element -> TestResult .ExecutionError .serializer()
93
- else -> error(" unknown object type" )
94
- }
95
- }
96
- }
You can’t perform that action at this time.
0 commit comments