Skip to content

Commit c4d94de

Browse files
authored
Merge pull request #43 from eclipsewebmaster/fix-context
Fixture context serialization; write also array in case if there is more than one default URL.
2 parents e5b25fb + 292362c commit c4d94de

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kotlin-wot/src/main/kotlin/thing/ContextSerializer.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ internal class ContextSerializer : JsonSerializer<Context>() {
2525
) {
2626
val defaultUrls: List<String> = context.defaultUrls
2727
val prefixedUrls: Map<String, String> = context.prefixedUrls
28-
val hasDefaultUrls = defaultUrls.isNotEmpty()
28+
val hasMoreThanOneDefaultUrl = defaultUrls.size > 1
2929
val hasPrefixedUrls = prefixedUrls.isNotEmpty()
30-
if (hasDefaultUrls && hasPrefixedUrls) {
30+
if (hasMoreThanOneDefaultUrl || hasPrefixedUrls) {
3131
gen.writeStartArray()
3232
}
3333
defaultUrls.forEach {
@@ -36,7 +36,7 @@ internal class ContextSerializer : JsonSerializer<Context>() {
3636
if (hasPrefixedUrls) {
3737
gen.writeObject(prefixedUrls)
3838
}
39-
if (hasDefaultUrls && hasPrefixedUrls) {
39+
if (hasMoreThanOneDefaultUrl || hasPrefixedUrls) {
4040
gen.writeEndArray()
4141
}
4242
}

0 commit comments

Comments
 (0)