You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.
When you get a List<Task> from something like dockerClient.listTasks(), each Task has two date/time fields: Task.updatedAt() and Task.status().timestamp(). The latter is the exact same timestamp format as all the other timestamps in the docker API, but unlike all the others which are deserialized to Date this one is deserialized to String.
Compare the two timestamps in the JSON that gets returned from GET /tasks:
The formats are identical. They both should be deserialized to the same type.
Solution
We should have a TaskStatus method that returns the timestamp as a Date.
Seems simple. Why haven't I made a PR for this already?
I can see what needs to change, but I want to get opinions on how best to do it. I can think of two ways, but there may be more.
Do I just change the signature of the existing method? This is super easy to do, but would break code for docker-client users.
Do I make a new method and deprecate the old one? Because this is an AutoValue class, jackson will give it the String that is is asking for in its @JsonCreator method; jackson will not also give us a Date for the same property in the JSON. So it will require a bit of manual work to turn the existing String into a Date. This work would not be required in the first option, where jackson does the work turning the raw JSON from docker into a Date directly without ever passing it through a String property.
The text was updated successfully, but these errors were encountered:
Description
When you get a
List<Task>
from something likedockerClient.listTasks()
, eachTask
has two date/time fields:Task.updatedAt()
andTask.status().timestamp()
. The latter is the exact same timestamp format as all the other timestamps in the docker API, but unlike all the others which are deserialized toDate
this one is deserialized toString
.Compare the two timestamps in the JSON that gets returned from
GET /tasks
:The formats are identical. They both should be deserialized to the same type.
Solution
We should have a
TaskStatus
method that returns the timestamp as aDate
.Seems simple. Why haven't I made a PR for this already?
I can see what needs to change, but I want to get opinions on how best to do it. I can think of two ways, but there may be more.
docker-client
users.AutoValue
class, jackson will give it theString
that is is asking for in its@JsonCreator
method; jackson will not also give us aDate
for the same property in the JSON. So it will require a bit of manual work to turn the existingString
into aDate
. This work would not be required in the first option, where jackson does the work turning the raw JSON from docker into aDate
directly without ever passing it through aString
property.The text was updated successfully, but these errors were encountered: