{"action":"created","issue":{"url":"https://api.github.com/repos/graphql-java/graphql-java/issues/938","repository_url":"https://api.github.com/repos/graphql-java/graphql-java","labels_url":"https://api.github.com/repos/graphql-java/graphql-java/issues/938/labels{/name}","comments_url":"https://api.github.com/repos/graphql-java/graphql-java/issues/938/comments","events_url":"https://api.github.com/repos/graphql-java/graphql-java/issues/938/events","html_url":"https://github.com/graphql-java/graphql-java/issues/938","id":299406435,"number":938,"title":"Unable to get raw variables/not parsed into arguments","user":{"login":"joshstrange","id":462796,"avatar_url":"https://avatars0.githubusercontent.com/u/462796?v=4","gravatar_id":"","url":"https://api.github.com/users/joshstrange","html_url":"https://github.com/joshstrange","followers_url":"https://api.github.com/users/joshstrange/followers","following_url":"https://api.github.com/users/joshstrange/following{/other_user}","gists_url":"https://api.github.com/users/joshstrange/gists{/gist_id}","starred_url":"https://api.github.com/users/joshstrange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshstrange/subscriptions","organizations_url":"https://api.github.com/users/joshstrange/orgs","repos_url":"https://api.github.com/users/joshstrange/repos","events_url":"https://api.github.com/users/joshstrange/events{/privacy}","received_events_url":"https://api.github.com/users/joshstrange/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-02-22T15:54:13Z","updated_at":"2018-03-04T05:11:10Z","closed_at":null,"author_association":"NONE","body":"I have the following query:\r\n\r\n````\r\nquery calendarItemQuery($title: String!) {\r\n\tCalendarItem(title: $title) {\r\n\t\ttitle\r\n\t\tstart(orderBy: DESC)\r\n\t}\r\n}\r\n````\r\n\r\nvariables:\r\n\r\n````\r\n{\r\n    \"title\": \"My title\"\r\n}\r\n````\r\n\r\nWhich works just fine, I can find the \"title\" -> \"My title\" mapping in `environment.getArgument(\"title\")`. However if I try this query instead:\r\n\r\n````\r\nquery calendarItemQuery($gt: Timestamp!) {\r\n\tCalendarItem {\r\n\t\ttitle\r\n\t\tstart(orderBy: DESC, greaterThan: $gt)\r\n\t}\r\n}\r\n````\r\n\r\nwith variables:\r\n\r\n````\r\n{\r\n    \"gt\": 1519448400\r\n}\r\n````\r\n\r\nThen `environment.getArguments()` is empty. I can see the variables on `environment.getSelectionSet().variables` but it is private and there is no way to get it. I have tracked my variable all the way though the codebase to when it disappears and it is [here](https://github.com/graphql-java/graphql-java/blob/688d15769e627c6fb3e55e2efd1ad2fe41b86626/src/main/java/graphql/execution/ExecutionStrategy.java#L199) when my variable is passed into `valuesResolver.getArgumentValues()`. My \"title\" makes it through but \"gt\" does not. Am I missing something about how I should be passing variables?"},"comment":{"url":"https://api.github.com/repos/graphql-java/graphql-java/issues/comments/370202731","html_url":"https://github.com/graphql-java/graphql-java/issues/938#issuecomment-370202731","issue_url":"https://api.github.com/repos/graphql-java/graphql-java/issues/938","id":370202731,"user":{"login":"bbakerman","id":1661769,"avatar_url":"https://avatars2.githubusercontent.com/u/1661769?v=4","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},"created_at":"2018-03-04T05:11:10Z","updated_at":"2018-03-04T05:11:10Z","author_association":"MEMBER","body":"Ahh I got it now - yes you can just invent argument names in graphql.\r\n\r\nFrom your example query above the argument to the user field is called \"username\".  It cannot be called 'user' or 'myUser' because the schema is a well defined thing.  fields and arguments MUST be called by the name\r\n\r\nI wrote a quick unit test to show this\r\n\r\n```\r\nclass Issue938 extends Specification {\r\n\r\n    public static GraphQLScalarType GraphQLTimestamp = new GraphQLScalarType(\"Timestamp\", \"Timestamp\", new Coercing() {\r\n        @Override\r\n        Object serialize(Object input) {\r\n            return input\r\n        }\r\n\r\n        @Override\r\n        Object parseValue(Object input) {\r\n            GregorianCalendar calendar = new GregorianCalendar()\r\n            BigInteger value = new BigInteger(String.valueOf(input))\r\n            calendar.setTimeInMillis(value.multiply(new BigInteger(\"1000\")).longValue())\r\n            return calendar\r\n        }\r\n\r\n        @Override\r\n        Object parseLiteral(Object input) {\r\n            if (input == null) {\r\n                return null\r\n            }\r\n            GregorianCalendar calendar = new GregorianCalendar()\r\n            calendar.setTimeInMillis(((IntValue) input).getValue().multiply(new BigInteger(\"1000\")).longValue())\r\n\r\n            return calendar\r\n        }\r\n    })\r\n\r\n    class UserImpl {\r\n        int id\r\n        String username\r\n        String email\r\n    }\r\n\r\n\r\n    def \"938 custom scalar and variables\"() {\r\n\r\n        def schemaSDL = '''\r\n            \r\n            type User {\r\n                id : Int\r\n                username : String \r\n                email : String\r\n            }\r\n            \r\n            type Query {\r\n                User(username : String!) : User\r\n            } \r\n        '''\r\n        def userDataFetcher = new DataFetcher() {\r\n            @Override\r\n            Object get(DataFetchingEnvironment env) {\r\n                def username = env.getArgument(\"username\")\r\n                return new UserImpl(id: 1, username: username, email: username + '@gmail.com')\r\n            }\r\n        }\r\n        def runtimeWiring = RuntimeWiring.newRuntimeWiring()\r\n                .scalar(GraphQLTimestamp)\r\n                .type(\r\n                TypeRuntimeWiring.newTypeWiring(\"Query\")\r\n                        .dataFetcher(\"User\", userDataFetcher)\r\n                        .build())\r\n                .build()\r\n        def schema = TestUtil.schema(schemaSDL, runtimeWiring)\r\n        def graphql = GraphQL.newGraphQL(schema).build();\r\n\r\n        when:\r\n        def input = ExecutionInput.newExecutionInput()\r\n                .query('''\r\n                        query myTwoBestFriends($friendOne: String!, $friendTwo: String!) {\r\n                            friendOne: User(username: $friendOne) {\r\n                                 id\r\n                                 username\r\n                                 email\r\n                            }\r\n                            friendTwo: User(username: $friendTwo) {\r\n                                 id\r\n                                 username\r\n                                 email\r\n                            }\r\n                        }\r\n                        ''')\r\n                .variables([\"friendOne\": \"joeyt\", \"friendTwo\": \"rossg\"])\r\n                .build()\r\n        def executionResult = graphql.execute(input)\r\n\r\n        then:\r\n        executionResult.errors.isEmpty()\r\n        executionResult.data == [friendOne:\r\n                                         [id: 1, username: 'joeyt', email: 'joeyt@gmail.com'],\r\n                                 friendTwo:\r\n                                         [id: 1, username: 'rossg', email: 'rossg@gmail.com']\r\n        ]\r\n\r\n\r\n    }\r\n```\r\n\r\nAll works as expected.  But the query arguments MUST be called 'username'.  \r\n\r\nIn fact working on this I found a NullPointerException bug in the new error reporting which I will fix.\r\n\r\nHence the PR associated with this issue.  However over all the system is working as expected regarding variables and so on as mentioned above"}}
{"actor":{"display_login":"bbakerman"}}