mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-16 00:21:19 +00:00
Support customizing date format in model (de)serialization in Java client
and update the default date format to conform to RFC3339
This commit is contained in:
@@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.*;
|
||||
import com.fasterxml.jackson.databind.*;
|
||||
import com.fasterxml.jackson.datatype.joda.*;
|
||||
|
||||
import java.text.DateFormat;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
@@ -20,6 +22,13 @@ public class JSON {
|
||||
mapper.registerModule(new JodaModule());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the date format for JSON (de)serialization with Date properties.
|
||||
*/
|
||||
public void setDateFormat(DateFormat dateFormat) {
|
||||
mapper.setDateFormat(dateFormat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize the given Java object into JSON string.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user