Skip to content

Commit ea7c926

Browse files
jwijgerdcowtowncoder
authored andcommitted
make DateTimeZoneSerializer set the type to "string" to improve schema support (currently the type will be any)
1 parent 21915d2 commit ea7c926

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/com/fasterxml/jackson/datatype/joda/ser/DateTimeZoneSerializer.java

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import java.io.IOException;
44

5+
import com.fasterxml.jackson.databind.JavaType;
6+
import com.fasterxml.jackson.databind.JsonMappingException;
7+
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper;
58
import org.joda.time.DateTimeZone;
69

710
import com.fasterxml.jackson.core.JsonGenerator;
@@ -32,4 +35,10 @@ public void serializeWithType(DateTimeZone value, JsonGenerator g,
3235
serialize(value, g, provider);
3336
typeSer.writeTypeSuffix(g, typeIdDef);
3437
}
38+
39+
@Override
40+
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
41+
throws JsonMappingException {
42+
visitor.expectStringFormat(typeHint);
43+
}
3544
}

0 commit comments

Comments
 (0)