{"action":"created","issue":{"url":"https://api.github.com/repos/brendanhay/amazonka/issues/257","labels_url":"https://api.github.com/repos/brendanhay/amazonka/issues/257/labels{/name}","comments_url":"https://api.github.com/repos/brendanhay/amazonka/issues/257/comments","events_url":"https://api.github.com/repos/brendanhay/amazonka/issues/257/events","html_url":"https://github.com/brendanhay/amazonka/issues/257","id":120021317,"number":257,"title":"Issues with empty PollForDecisionTask and PollForActivityTask responses","user":{"login":"mfine","id":60851,"avatar_url":"https://avatars.githubusercontent.com/u/60851?v=3","gravatar_id":"","url":"https://api.github.com/users/mfine","html_url":"https://github.com/mfine","followers_url":"https://api.github.com/users/mfine/followers","following_url":"https://api.github.com/users/mfine/following{/other_user}","gists_url":"https://api.github.com/users/mfine/gists{/gist_id}","starred_url":"https://api.github.com/users/mfine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfine/subscriptions","organizations_url":"https://api.github.com/users/mfine/orgs","repos_url":"https://api.github.com/users/mfine/repos","events_url":"https://api.github.com/users/mfine/events{/privacy}","received_events_url":"https://api.github.com/users/mfine/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-02T19:47:57Z","updated_at":"2015-12-17T18:48:24Z","closed_at":"2015-12-17T14:41:20Z","body":"Running into issues with empty polls where de-serialization fails because SWF doesn't seem to be conforming to its models:\r\n\r\n## Failing\r\n\r\n### Empty PollForDecisionTask (FAIL)\r\n\r\n    [Client Request] {\r\n      host      = swf.us-west-2.amazonaws.com:443\r\n      secure    = True\r\n      method    = POST\r\n      target    = Just SimpleWorkflowService.PollForDecisionTask\r\n      timeout   = Just 70000000000000\r\n      redirects = 0\r\n      path      = /\r\n      query     =\r\n      headers   = host: swf.us-west-2.amazonaws.com; x-amz-date: 20151202T185851Z; x-amz-content-sha256: xxx; x-amz-target: SimpleWorkflowService.PollForDecisionTask; content-type: application/x-amz-json-1.0; authorization: AWS4-HMAC-SHA256 Credential=xxx, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target, Signature=xxx\r\n      body      = {\"domain\":\"hello-world\",\"reverseOrder\":true,\"taskList\":{\"name\":\"hello-world-queue\"},\"maximumPageSize\":100}\r\n    }\r\n    [Client Response] {\r\n      status  = 200 OK\r\n      headers = x-amzn-requestid: xxx; content-type: application/x-amz-json-1.0; content-length: 47\r\n    }\r\n    [Raw Response Body] {\r\n    {\"previousStartedEventId\":0,\"startedEventId\":0}\r\n    }\r\n    [SerializeError] {\r\n      service = SWF\r\n      status  = 200 OK\r\n      message = key \"taskToken\" not present\r\n    }\r\n\r\n### Empty PollForActivityTask (FAIL)\r\n\r\n    [Client Request] {\r\n      host      = swf.us-west-2.amazonaws.com:443\r\n      secure    = True\r\n      method    = POST\r\n      target    = Just SimpleWorkflowService.PollForActivityTask\r\n      timeout   = Just 70000000000000\r\n      redirects = 0\r\n      path      = /\r\n      query     =\r\n      headers   = host: swf.us-west-2.amazonaws.com; x-amz-date: 20151202T190200Z; x-amz-content-sha256: xxx; x-amz-target: SimpleWorkflowService.PollForActivityTask; content-type: application/x-amz-json-1.0; authorization: AWS4-HMAC-SHA256 Credential=xxx, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target, Signature=xxx\r\n      body      = {\"domain\":\"hello-world\",\"taskList\":{\"name\":\"hello-queue\"}}\r\n    }\r\n    [Client Response] {\r\n      status  = 200 OK\r\n      headers = x-amzn-requestid: xxx; content-type: application/x-amz-json-1.0; content-length: 20\r\n    }\r\n    [Raw Response Body] {\r\n    {\"startedEventId\":0}\r\n    }\r\n    [SerializeError] {\r\n      service = SWF\r\n      status  = 200 OK\r\n      message = key \"taskToken\" not present\r\n    }\r\n\r\n## Passing\r\n\r\n### Non-Empty PollForDecisionTask (PASS)\r\n\r\n    [Client Request] {\r\n      host      = swf.us-west-2.amazonaws.com:443\r\n      secure    = True\r\n      method    = POST\r\n      target    = Just SimpleWorkflowService.PollForDecisionTask\r\n      timeout   = Just 70000000000000\r\n      redirects = 0\r\n      path      = /\r\n      query     =\r\n      headers   = host: swf.us-west-2.amazonaws.com; x-amz-date: 20151202T190829Z; x-amz-content-sha256: xxx; x-amz-target: SimpleWorkflowService.PollForDecisionTask; content-type: application/x-amz-json-1.0; authorization: AWS4-HMAC-SHA256 Credential=xxx, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target, Signature=xxx\r\n      body      = {\"domain\":\"hello-world\",\"reverseOrder\":true,\"taskList\":{\"name\":\"hello-world-queue\"},\"maximumPageSize\":100}\r\n    }\r\n    [Client Response] {\r\n      status  = 200 OK\r\n      headers = x-amzn-requestid: xxx; content-type: application/x-amz-json-1.0; content-length: 2609\r\n    }\r\n    [Raw Response Body] {\r\n    {\"events\":[{\"decisionTaskStartedEventAttributes\":{\"scheduledEventId\":8},\"eventId\":9,\"eventTimestamp\":1.449083309828E9,\"eventType\":\"DecisionTaskStarted\"},{\"decisionTaskScheduledEventAttributes\":{\"startToCloseTimeout\":\"60\",\"taskList\":{\"name\":\"hello-world-queue\"}},\"eventId\":8,\"eventTimestamp\":1.449083237789E9,\"eventType\":\"DecisionTaskScheduled\"},{\"activityTaskTimedOutEventAttributes\":{\"scheduledEventId\":5,\"startedEventId\":6,\"timeoutType\":\"START_TO_CLOSE\"},\"eventId\":7,\"eventTimestamp\":1.449083237789E9,\"eventType\":\"ActivityTaskTimedOut\"},{\"activityTaskStartedEventAttributes\":{\"scheduledEventId\":5},\"eventId\":6,\"eventTimestamp\":1.449083137778E9,\"eventType\":\"ActivityTaskStarted\"},{\"activityTaskScheduledEventAttributes\":{\"activityId\":\"2e99c751-002a-44eb-8340-a65445d4216d\",\"activityType\":{\"name\":\"Hello\",\"version\":\"1.0\"},\"decisionTaskCompletedEventId\":4,\"heartbeatTimeout\":\"NONE\",\"input\":\"{\\n  \\\"step-0\\\": \\\"execute\\\"\\n}\\n\",\"scheduleToCloseTimeout\":\"NONE\",\"scheduleToStartTimeout\":\"60\",\"startToCloseTimeout\":\"100\",\"taskList\":{\"name\":\"hello-queue\"}},\"eventId\":5,\"eventTimestamp\":1.449083137731E9,\"eventType\":\"ActivityTaskScheduled\"},{\"decisionTaskCompletedEventAttributes\":{\"scheduledEventId\":2,\"startedEventId\":3},\"eventId\":4,\"eventTimestamp\":1.449083137731E9,\"eventType\":\"DecisionTaskCompleted\"},{\"decisionTaskStartedEventAttributes\":{\"scheduledEventId\":2},\"eventId\":3,\"eventTimestamp\":1.449083137612E9,\"eventType\":\"DecisionTaskStarted\"},{\"decisionTaskScheduledEventAttributes\":{\"startToCloseTimeout\":\"60\",\"taskList\":{\"name\":\"hello-world-queue\"}},\"eventId\":2,\"eventTimestamp\":1.449083115695E9,\"eventType\":\"DecisionTaskScheduled\"},{\"eventId\":1,\"eventTimestamp\":1.449083115695E9,\"eventType\":\"WorkflowExecutionStarted\",\"workflowExecutionStartedEventAttributes\":{\"childPolicy\":\"ABANDON\",\"executionStartToCloseTimeout\":\"300\",\"input\":\"{\\n  \\\"step-0\\\": \\\"execute\\\"\\n}\\n\",\"parentInitiatedEventId\":0,\"taskList\":{\"name\":\"hello-world-queue\"},\"taskStartToCloseTimeout\":\"60\",\"workflowType\":{\"name\":\"HelloWorld\",\"version\":\"1.0\"}}}],\"previousStartedEventId\":3,\"startedEventId\":9,\"taskToken\":\"AAAAKgAAAAIAAAAAAAAAAxLGr2/uDoZMAhWy1gmiF7C+/OXh8EZDgs/BFrE74YfGXtmlfgC2OmnceXa8bhjhQpl2fG1jJovu82ED7GLbKRTmzfCS8YppGU+RbBVr9nlKKjYa/ToB/AjM8RW5BeMN+9Rr/e70C0bJOGs68r7UewhJzAWYuxPQfY2iPO1JgeqEVGdL8SknhmrYT8MOciTnZX7CmTuKRbQ0wX4ZjL0LlKqQTsAqOvVheC+iaIOf92rDfijkL5EQYxvgojIdsRWHJJR2zeWoslZwvveNbY8i3b51FD1p/dxB+4ouUt9BurXBPFkj67X0j45p9xkwwRDYkw==\",\"workflowExecution\":{\"runId\":\"23IvIkYB9xFvVJwMpM+0ANpM7rEjD31QqX5do6138ujAA=\",\"workflowId\":\"dc8df543-69b7-411e-b059-974a20e98b96\"},\"workflowType\":{\"name\":\"HelloWorld\",\"version\":\"1.0\"}}\r\n    }\r\n\r\n### Non-Empty PollForActivityTask (PASS)\r\n\r\n    [Client Request] {\r\n      host      = swf.us-west-2.amazonaws.com:443\r\n      secure    = True\r\n      method    = POST\r\n      target    = Just SimpleWorkflowService.PollForActivityTask\r\n      timeout   = Just 70000000000000\r\n      redirects = 0\r\n      path      = /\r\n      query     =\r\n      headers   = host: swf.us-west-2.amazonaws.com; x-amz-date: 20151202T190917Z; x-amz-content-sha256: xxx; x-amz-target: SimpleWorkflowService.PollForActivityTask; content-type: application/x-amz-json-1.0; authorization: AWS4-HMAC-SHA256 Credential=xxx, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target, Signature=xxx\r\n      body      = {\"domain\":\"hello-world\",\"taskList\":{\"name\":\"hello-queue\"}}\r\n    }\r\n    [Client Response] {\r\n      status  = 200 OK\r\n      headers = x-amzn-requestid: xxx; content-type: application/x-amz-json-1.0; content-length: 655\r\n    }\r\n    [Raw Response Body] {\r\n    {\"activityId\":\"76d0006e-35d7-4c87-adfd-0f1bc31fc901\",\"activityType\":{\"name\":\"Hello\",\"version\":\"1.0\"},\"input\":\"{\\n  \\\"step-0\\\": \\\"execute\\\"\\n}\\n\",\"startedEventId\":12,\"taskToken\":\"AAAAKgAAAAIAAAAAAAAAA9L0rkHPWDPNCx40dFjaOO3dVqwdyypqjpOK4XCyYW94qw/L3KPJAivnmnn24j69XEes94iu1uQQ7p8dgppErUl9H7rsvrxLmoF5EhlE/WJLj1Mw/TxpN8NqaunH6XtoKu7URZkcth2D2IkmDzPVRhsFdyPutP2n5JpRh3ThOgjcynEeyMnxOHBx8XGMjNi6n6VwUsg3Bi10N2XVL6JrDzT7CiK44HR/2lxAGR3n+/eLHG1P50yANjpDLKTbbzridEsFphZ5lJpJ9mujjTI6OrFQU841ymocnwe/1OgUcusGhGmnlVoKotoChIcB6MwFBg==\",\"workflowExecution\":{\"runId\":\"23IvIkYB9xFvVJwMpM+0ANpM7rEjD31QqX5do6138ujAA=\",\"workflowId\":\"dc8df543-69b7-411e-b059-974a20e98b96\"}}\r\n    }\r\n\r\nI'm confused because the models for both indicate these are mandatory attributes:\r\n\r\nhttps://github.com/brendanhay/amazonka/blob/develop/gen/model/swf/2012-01-25/service-2.json#L812-L818\r\nhttps://github.com/brendanhay/amazonka/blob/develop/gen/model/swf/2012-01-25/service-2.json#L1745-L1753\r\n\r\nLooking around in other related SDKs (e.g., aws-sdk-go), there's mention of the fields coming back as `nil` (which I think is how their JSON parsers will work in the absence of a field). It's almost like maybe there are no required fields - everything should be Maybe :("},"comment":{"url":"https://api.github.com/repos/brendanhay/amazonka/issues/comments/165545477","html_url":"https://github.com/brendanhay/amazonka/issues/257#issuecomment-165545477","issue_url":"https://api.github.com/repos/brendanhay/amazonka/issues/257","id":165545477,"user":{"login":"mfine","id":60851,"avatar_url":"https://avatars.githubusercontent.com/u/60851?v=3","gravatar_id":"","url":"https://api.github.com/users/mfine","html_url":"https://github.com/mfine","followers_url":"https://api.github.com/users/mfine/followers","following_url":"https://api.github.com/users/mfine/following{/other_user}","gists_url":"https://api.github.com/users/mfine/gists{/gist_id}","starred_url":"https://api.github.com/users/mfine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfine/subscriptions","organizations_url":"https://api.github.com/users/mfine/orgs","repos_url":"https://api.github.com/users/mfine/repos","events_url":"https://api.github.com/users/mfine/events{/privacy}","received_events_url":"https://api.github.com/users/mfine/received_events","type":"User","site_admin":false},"created_at":"2015-12-17T18:48:24Z","updated_at":"2015-12-17T18:48:24Z","body":"Thanks! Nice solution - sorry it had to come to that :( Will check things out!"}}