Skip to content

Commit 75bc160

Browse files
committed
Workaround for correct types to be referenced during serialization
The problem is passing `OneOrMany<IInterface>` is that the serializer will only look at the interface properties rather than the real types. This forces the individual types to be recognised when serializing a `OneOrMany`.
1 parent 0a08a75 commit 75bc160

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Source/Schema.NET/ValuesJsonConverter.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,13 @@ public override void Write(Utf8JsonWriter writer, IValues value, JsonSerializerO
180180
}
181181
else
182182
{
183-
this.WriteObject(writer, values, options);
183+
writer.WriteStartArray();
184+
foreach (var item in values)
185+
{
186+
this.WriteObject(writer, item, options);
187+
}
188+
189+
writer.WriteEndArray();
184190
}
185191
}
186192

0 commit comments

Comments
 (0)