package valandur.webapi.json.serializers.world;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.spongepowered.api.world.GeneratorType;

import java.io.IOException;

public class GeneratorTypeSerializer extends StdSerializer<GeneratorType> {

    public GeneratorTypeSerializer() {
        this(null);
    }

    public GeneratorTypeSerializer(Class<GeneratorType> t) {
        super(t);
    }

    @Override
    public void serialize(GeneratorType value, JsonGenerator gen, SerializerProvider provider) throws IOException {
        gen.writeStartObject();
        gen.writeStringField("id", value.getId());
        gen.writeStringField("name", value.getName());
        gen.writeObjectField("settings", value.getGeneratorSettings());
        gen.writeEndObject();
    }
}

@@ -206,24 +206,69 @@
 Serializer;%0A
+import org.spongepowered.api.data.DataQuery;%0A
 import org.s
@@ -333,16 +333,91 @@
 ception;
+%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.Optional;
 %0A%0Apublic
@@ -919,69 +919,379 @@
     
-gen.writeObjectField(%22settings%22, value.getGeneratorSettings()
+Map%3CString, Object%3E settings = new HashMap%3C%3E();%0A        for (DataQuery query : value.getGeneratorSettings().getKeys(true)) %7B%0A            Optional val = value.getGeneratorSettings().get(query);%0A            if (!val.isPresent())%0A                continue;%0A%0A            settings.put(query.asString(%22.%22), val.get());%0A        %7D%0A        gen.writeObjectField(%22settings%22, settings
 );%0A 

Fix generator type serializer not serializing properties