Deserialize problem on LocalDate
@kamperiadis đang làm issue này rồi.
Từ ngày 13/6/2023.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
When returning an object containing a LocalDate, I get the following error.
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from Object value (token `JsonToken.START_OBJECT`)
at [Source: (String)"{"date":{"year":2023,"month":5,"day":13},"value":"foo"}"; line: 1, column: 1]
...
at com.microsoft.durabletask.JacksonDataConverter.deserialize(JacksonDataConverter.java:40)
I believe this date format is coming from protobuf?
I can solve this problem by writing my own custom Jackson deserializer but shouldn't this be handled for us?
Maybe it's possible to return { "date": "2023-05-13" } instead? This way I can add jackson-datatype-jsr310 to the class path and com.microsoft.durabletask.JacksonDataConverter will pick it up.
Example code:
public class ExampleFunction {
@FunctionName("StartOrchestration")
public HttpResponseMessage startOrchestration(
@HttpTrigger(name = "req",
methods = {HttpMethod.GET, HttpMethod.POST},
authLevel = AuthorizationLevel.ANONYMOUS) final HttpRequestMessage<Optional<String>> request,
@DurableClientInput(name = "durableContext") final DurableClientContext durableContext,
final ExecutionContext context) {
context.getLogger().info("Java HTTP trigger processed a request");
final DurableTaskClient client = durableContext.getClient();
final String instanceId = client.scheduleNewOrchestrationInstance("ExampleProcess");
return durableContext.createCheckStatusResponse(request, instanceId);
}
@FunctionName("ExampleProcess")
public String exampleOrchestrator(
@DurableOrchestrationTrigger(name = "taskOrchestrationContext") final TaskOrchestrationContext context,
final ExecutionContext functionContext) {
return context.callActivity("ToLower", "Foo", String.class).await() +
" " +
context.callActivity("ToLower", "Bar", String.class).await();
}
@FunctionName("ToLower")
public ExampleResponse toLower(@DurableActivityTrigger(name = "value") final String value, final ExecutionContext context) {
return new ExampleResponse(LocalDate.now(), value.toLowerCase());
}
}
public class ExampleResponse {
private LocalDate date;
private String value;
...
}
- Ngôn ngữ chính
- Java
- Star
- 29
- Fork
- 18
- Merge trung bình
- 1 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 2
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/durabletask-java
-
Needs: Triage :mag:
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
microsoft/durabletask-java#303 ·
-
RetryContext.lastAttemptNumber is inflated when retriable task is awaited via ctx.anyOf(...) Đang mởNeeds: Triage :mag:
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
microsoft/durabletask-java#290 · 2 bình luận ·
-
Needs: Triage :mag:
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
microsoft/durabletask-java#285 ·
-
Needs: Triage :mag:
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
microsoft/durabletask-java#276 ·
-
Enhancement
microsoft/durabletask-java#274 · 1 reaction · 2 người được giao ·
Tất cả issue của microsoft/durabletask-java
Issue tương tự
-
Bug Java Platform: Java
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
getsentry/sentry-java#6138 · 1 bình luận ·
-
bug needs triage p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · 1 bình luận ·
-
[Studio][Bug] Bulk-deleting a full page of alert rules steps the page back while more rules remain Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/rocketmq-dashboard#4654 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100