{"action":"opened","issue":{"url":"https://api.github.com/repos/graphql-java/graphql-java/issues/259","repository_url":"https://api.github.com/repos/graphql-java/graphql-java","labels_url":"https://api.github.com/repos/graphql-java/graphql-java/issues/259/labels{/name}","comments_url":"https://api.github.com/repos/graphql-java/graphql-java/issues/259/comments","events_url":"https://api.github.com/repos/graphql-java/graphql-java/issues/259/events","html_url":"https://github.com/graphql-java/graphql-java/issues/259","id":194514888,"number":259,"title":"Co-ercion on Longs dont not handle Double / Float inputs","user":{"login":"bbakerman","id":1661769,"avatar_url":"https://avatars.githubusercontent.com/u/1661769?v=3","gravatar_id":"","url":"https://api.github.com/users/bbakerman","html_url":"https://github.com/bbakerman","followers_url":"https://api.github.com/users/bbakerman/followers","following_url":"https://api.github.com/users/bbakerman/following{/other_user}","gists_url":"https://api.github.com/users/bbakerman/gists{/gist_id}","starred_url":"https://api.github.com/users/bbakerman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbakerman/subscriptions","organizations_url":"https://api.github.com/users/bbakerman/orgs","repos_url":"https://api.github.com/users/bbakerman/repos","events_url":"https://api.github.com/users/bbakerman/events{/privacy}","received_events_url":"https://api.github.com/users/bbakerman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-09T05:03:11Z","updated_at":"2016-12-09T05:03:11Z","closed_at":null,"body":"     public static GraphQLScalarType GraphQLLong = new GraphQLScalarType(\"Long\", \"Long type\", new Coercing() {\r\n        @Override\r\n        public Object serialize(Object input) {\r\n            if (input instanceof String) {\r\n                return Long.parseLong((String) input);\r\n            } else if (input instanceof Long) {\r\n                return input;\r\n            } else if (input instanceof Integer) {\r\n                return ((Integer) input).longValue();\r\n            } else {\r\n                return null;\r\n            }\r\n        }\r\n\r\nIf the input to this is a double then it wil nbot try andget the longValue() of it and rather it will set it to null\r\n\r\nThe reason this is a problem is that JSON input systems like GSON will take String input like\r\n\r\n    {\r\n      \"serviceDeskId\" : 1\r\n    }\r\n\r\nand create a Map object like\r\n\r\n    \"serviceDeskId\" -> \"1.0\"\r\n\r\nbecause numbers in JSON can be doubles.\r\n\r\nI think its very unexpected that an input for variables for \"x\" : 1 actually ends up as null and having to do \"x\" : \"1\" is also unexpected\r\n\r\n"}}
{"actor":{"display_login":"bbakerman"}}