Commit 72ba6f56 authored by Jean Meurice's avatar Jean Meurice
Browse files

JSON subtyped/customJson fix

parent 633ec13d
Pipeline #416037 passed with stage
in 48 seconds
......@@ -8,7 +8,7 @@
<groupId>montisim</groupId>
<artifactId>commons</artifactId>
<version>2.0.14</version>
<version>2.0.15</version>
<properties>
......
......@@ -151,7 +151,7 @@ public class StructType extends DataType implements CustomJson {
@Override
public void write(JsonWriter w, BuildContext context) throws SerializationException {
w.startObject();
w.write("type", "struct");
w.write("type", TYPE);
w.write("name", name);
w.writeKey("fields");
......
......@@ -286,6 +286,10 @@ public abstract class Json {
throw new IllegalArgumentException("Enums cannot be typed.");
String type = typed ? ta.value().length() > 0 ? ta.value() : c.getSimpleName() : null;
if (typed) {
registerSubtype(c, type);
}
Writer writer = null;
Reader reader = null;
......@@ -353,10 +357,6 @@ public abstract class Json {
final HashMap<String, FieldInfo> map = new HashMap<>();
getFields(c, fields, map, obj, all);
if (typed) {
registerSubtype(c, type);
}
writer = (w, o, context) -> {
if (obj)
w.startObject();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment