Title: Deserialize problem on LocalDate · Issue #134 · microsoft/durabletask-java · GitHub
Open Graph Title: Deserialize problem on LocalDate · Issue #134 · microsoft/durabletask-java
X Title: Deserialize problem on LocalDate · Issue #134 · microsoft/durabletask-java
Description: 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.S...
Open Graph Description: 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.Strin...
X Description: 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.Strin...
Opengraph URL: https://github.com/microsoft/durabletask-java/issues/134
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deserialize problem on LocalDate","articleBody":"When returning an object containing a LocalDate, I get the following error.\r\n\r\n```\r\nCaused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from Object value (token `JsonToken.START_OBJECT`)\r\n at [Source: (String)\"{\"date\":{\"year\":2023,\"month\":5,\"day\":13},\"value\":\"foo\"}\"; line: 1, column: 1] \r\n...\r\n at com.microsoft.durabletask.JacksonDataConverter.deserialize(JacksonDataConverter.java:40)\r\n```\r\n\r\nI believe this date format is coming from protobuf?\r\nI can solve this problem by writing my own custom Jackson deserializer but shouldn't this be handled for us?\r\nMaybe 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. \r\n\r\nExample code:\r\n\r\n```\r\npublic class ExampleFunction {\r\n\r\n @FunctionName(\"StartOrchestration\")\r\n public HttpResponseMessage startOrchestration(\r\n @HttpTrigger(name = \"req\",\r\n methods = {HttpMethod.GET, HttpMethod.POST},\r\n authLevel = AuthorizationLevel.ANONYMOUS) final HttpRequestMessage\u003cOptional\u003cString>> request,\r\n @DurableClientInput(name = \"durableContext\") final DurableClientContext durableContext,\r\n final ExecutionContext context) {\r\n context.getLogger().info(\"Java HTTP trigger processed a request\");\r\n\r\n final DurableTaskClient client = durableContext.getClient();\r\n final String instanceId = client.scheduleNewOrchestrationInstance(\"ExampleProcess\");\r\n return durableContext.createCheckStatusResponse(request, instanceId);\r\n }\r\n\r\n @FunctionName(\"ExampleProcess\")\r\n public String exampleOrchestrator(\r\n @DurableOrchestrationTrigger(name = \"taskOrchestrationContext\") final TaskOrchestrationContext context,\r\n final ExecutionContext functionContext) {\r\n return context.callActivity(\"ToLower\", \"Foo\", String.class).await() +\r\n \" \" +\r\n context.callActivity(\"ToLower\", \"Bar\", String.class).await();\r\n }\r\n\r\n @FunctionName(\"ToLower\")\r\n public ExampleResponse toLower(@DurableActivityTrigger(name = \"value\") final String value, final ExecutionContext context) {\r\n return new ExampleResponse(LocalDate.now(), value.toLowerCase());\r\n }\r\n}\r\n\r\npublic class ExampleResponse {\r\n private LocalDate date;\r\n private String value;\r\n\r\n ...\r\n}\r\n```\r\n","author":{"url":"https://github.com/nicktombeur","@type":"Person","name":"nicktombeur"},"datePublished":"2023-05-13T16:45:50Z","url":"https://github.com/microsoft/durabletask-java/issues/134"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f4475419-90ff-b587-8e61-43e7ee9b57fb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C584:265EB5:1C8982:257818:6AFE48A4 |
| html-safe-nonce | a558dd126d18e4850a940c5a104dc0ceb6942568a1127d95924dc6b4d8517960 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNTg0OjI2NUVCNToxQzg5ODI6MjU3ODE4OjZBRkU0OEE0IiwidmlzaXRvcl9pZCI6Ijc2NTY2MTE4MDc4MDAyMTU3MTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9dff2492bccb6e7a3d14807baac77dd72c9be769d3dec162f62e840b03cd1bfc |
| hovercard-subject-tag | issue:1708680210 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/durabletask-java/134/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3ae7d25ffcd2b6f90ef5ceda78e8eea046d34d107c7b0b99f5bd9ce7f0d91bc2/microsoft/durabletask-java/issues/134 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3ae7d25ffcd2b6f90ef5ceda78e8eea046d34d107c7b0b99f5bd9ce7f0d91bc2/microsoft/durabletask-java/issues/134 |
| og:image:alt | 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.Strin... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nicktombeur |
| hostname | github.com |
| expected-hostname | github.com |
| None | f1a5901e2377b0af2a0b303f9528678f1475d04b9219dca1e993344196eaa07c |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/durabletask-java git https://github.com/microsoft/durabletask-java.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 452823832 |
| octolytics-dimension-repository_nwo | microsoft/durabletask-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 452823832 |
| octolytics-dimension-repository_network_root_nwo | microsoft/durabletask-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ce393ea11ad276623b946bc9663d3e7d6f564275 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width