{"action":"opened","issue":{"url":"https://api.github.com/repos/SaturnFramework/Saturn/issues/115","repository_url":"https://api.github.com/repos/SaturnFramework/Saturn","labels_url":"https://api.github.com/repos/SaturnFramework/Saturn/issues/115/labels{/name}","comments_url":"https://api.github.com/repos/SaturnFramework/Saturn/issues/115/comments","events_url":"https://api.github.com/repos/SaturnFramework/Saturn/issues/115/events","html_url":"https://github.com/SaturnFramework/Saturn/issues/115","id":342712226,"node_id":"MDU6SXNzdWUzNDI3MTIyMjY=","number":115,"title":"Deeply nested controllers throw an invalid cast exception","user":{"login":"TWith2Sugars","id":234112,"node_id":"MDQ6VXNlcjIzNDExMg==","avatar_url":"https://avatars0.githubusercontent.com/u/234112?v=4","gravatar_id":"","url":"https://api.github.com/users/TWith2Sugars","html_url":"https://github.com/TWith2Sugars","followers_url":"https://api.github.com/users/TWith2Sugars/followers","following_url":"https://api.github.com/users/TWith2Sugars/following{/other_user}","gists_url":"https://api.github.com/users/TWith2Sugars/gists{/gist_id}","starred_url":"https://api.github.com/users/TWith2Sugars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TWith2Sugars/subscriptions","organizations_url":"https://api.github.com/users/TWith2Sugars/orgs","repos_url":"https://api.github.com/users/TWith2Sugars/repos","events_url":"https://api.github.com/users/TWith2Sugars/events{/privacy}","received_events_url":"https://api.github.com/users/TWith2Sugars/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-19T12:43:51Z","updated_at":"2018-07-19T12:43:51Z","closed_at":null,"author_association":"NONE","body":"If I have a controller setup like so (I extended the Controller.Sample to track this down)\r\n\r\n`\r\nlet commentController2 (userId:int)(x:int) = controller {\r\n    index (fun ctx -> (sprintf \"Comment Index handler for user %i\" userId ) |> Controller.text ctx)\r\n    add (fun ctx -> (sprintf \"Comment Add handler for user %i\" userId ) |> Controller.text ctx)\r\n    show (fun ctx id -> (sprintf \"Show comment %s handler for user %i\" id userId ) |> Controller.text ctx)\r\n    edit (fun ctx id -> (sprintf \"Edit comment %s handler for user %i\" id userId )  |> Controller.text ctx)\r\n}\r\n\r\nlet commentController userId = controller {\r\n    subController \"/sub\" (commentController2 userId)\r\n    index (fun ctx -> (sprintf \"Comment Index handler for user %i\" userId ) |> Controller.text ctx)\r\n    add (fun ctx -> (sprintf \"Comment Add handler for user %i\" userId ) |> Controller.text ctx)\r\n    show (fun ctx id -> (sprintf \"Show comment %O handler for user %i\" id userId ) |> Controller.text ctx)\r\n    edit (fun ctx id -> (sprintf \"Edit comment %O handler for user %i\" id userId )  |> Controller.text ctx)\r\n}\r\n\r\ntype Response = {\r\n    a: string\r\n    b: string\r\n}\r\n\r\ntype DifferentResponse = {\r\n    c: int\r\n    d: DateTime\r\n}\r\n\r\nlet typedController = controller {\r\n    subController \"/tc\" commentController\r\n\r\n    index (fun _ -> task {\r\n        return {a = \"hello\"; b = \"world\"}\r\n    })\r\n\r\n    show (fun _ a -> task {\r\n        return {c = a; d = DateTime.Now}\r\n    })\r\n\r\n    add (fun _ -> task {\r\n        return {c = 123; d = DateTime.Now}\r\n    })\r\n}\r\n\r\nlet topRouter = router {\r\n    forward \"/users\" userControllerVersion1\r\n    forward \"/users\" userController\r\n    forward \"/typed\" typedController\r\n    forwardf \"/%s/%s/abc\" (fun (a : string * string) -> otherRouter)\r\n}\r\n`\r\nWhen I attempt to route to a sub controller I get an invalid cast exception here:\r\nhttps://github.com/SaturnFramework/Saturn/blob/master/src/Saturn/Controller.fs#L303\r\n\r\nTrying to cast a tuple to a string."}}
{"actor":{"display_login":"TWith2Sugars"}}