{"action":"created","issue":{"url":"https://api.github.com/repos/andimarek/graphql-java/issues/118","repository_url":"https://api.github.com/repos/andimarek/graphql-java","labels_url":"https://api.github.com/repos/andimarek/graphql-java/issues/118/labels{/name}","comments_url":"https://api.github.com/repos/andimarek/graphql-java/issues/118/comments","events_url":"https://api.github.com/repos/andimarek/graphql-java/issues/118/events","html_url":"https://github.com/andimarek/graphql-java/issues/118","id":145004167,"number":118,"title":"Recursive GraphQLTypeReference resolution","user":{"login":"yrashk","id":452,"avatar_url":"https://avatars.githubusercontent.com/u/452?v=3","gravatar_id":"","url":"https://api.github.com/users/yrashk","html_url":"https://github.com/yrashk","followers_url":"https://api.github.com/users/yrashk/followers","following_url":"https://api.github.com/users/yrashk/following{/other_user}","gists_url":"https://api.github.com/users/yrashk/gists{/gist_id}","starred_url":"https://api.github.com/users/yrashk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yrashk/subscriptions","organizations_url":"https://api.github.com/users/yrashk/orgs","repos_url":"https://api.github.com/users/yrashk/repos","events_url":"https://api.github.com/users/yrashk/events{/privacy}","received_events_url":"https://api.github.com/users/yrashk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-31T20:07:03Z","updated_at":"2016-04-19T22:35:58Z","closed_at":null,"body":"I am wondering if type reference resolution should go deeper beyond one level.\r\n\r\nRight now, according to my best understanding of https://github.com/andimarek/graphql-java/blob/master/src/main/java/graphql/schema/SchemaUtil.java#L149-L155, for every object's field, it will do a type resolution. However, if that resolved type itself contains further type references, they won't be processed. Is this intentional or should it be improved? Happy to work on a PR if you think this should be improved."},"comment":{"url":"https://api.github.com/repos/andimarek/graphql-java/issues/comments/212156330","html_url":"https://github.com/andimarek/graphql-java/issues/118#issuecomment-212156330","issue_url":"https://api.github.com/repos/andimarek/graphql-java/issues/118","id":212156330,"user":{"login":"danielkwinsor","id":2822992,"avatar_url":"https://avatars.githubusercontent.com/u/2822992?v=3","gravatar_id":"","url":"https://api.github.com/users/danielkwinsor","html_url":"https://github.com/danielkwinsor","followers_url":"https://api.github.com/users/danielkwinsor/followers","following_url":"https://api.github.com/users/danielkwinsor/following{/other_user}","gists_url":"https://api.github.com/users/danielkwinsor/gists{/gist_id}","starred_url":"https://api.github.com/users/danielkwinsor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielkwinsor/subscriptions","organizations_url":"https://api.github.com/users/danielkwinsor/orgs","repos_url":"https://api.github.com/users/danielkwinsor/repos","events_url":"https://api.github.com/users/danielkwinsor/events{/privacy}","received_events_url":"https://api.github.com/users/danielkwinsor/received_events","type":"User","site_admin":false},"created_at":"2016-04-19T22:35:58Z","updated_at":"2016-04-19T22:35:58Z","body":"Just hit this too, here's a test case that reproduces the issue.\r\n\r\nIt affects queries not just on the object, but on the __schema too.\r\n\r\n\r\n```\r\n    @Test\r\n    public void testRecursionByHand() throws Exception {\r\n        logger.debug(\"testRecursionByHand\");\r\n        GraphQLOutputType recursiveClass = GraphQLObjectType.newObject()\r\n                .name(\"RecursiveClass\")\r\n                .field(newFieldDefinition()\r\n                        .type(Scalars.GraphQLString)\r\n                        .name(\"recursionLevel\")\r\n                        .build())\r\n                .field(newFieldDefinition()\r\n                        .type(new GraphQLTypeReference(\"RecursiveClass\"))\r\n                        .name(\"recursive\")\r\n                        .build())\r\n                .build();\r\n        GraphQLObjectType queryType = newObject()\r\n                .name(\"testQuery\")\r\n                .field(newFieldDefinition()\r\n                        .type((GraphQLOutputType) recursiveClass)\r\n                        .name(\"testObj\")\r\n                        .staticValue(new RecursiveClass(2))\r\n                        .build())\r\n                .build();\r\n        GraphQLSchema recursiveTestSchema = GraphQLSchema.newSchema()\r\n                .query(queryType)\r\n                .build();\r\n        \r\n        String query = \"\"\r\n        + \"query testSchema {\"\r\n        + \"  __schema {\"\r\n        + \"    types {\"\r\n        + \"      name\"\r\n        + \"      fields {\"\r\n        + \"        name\"\r\n        + \"        type {\"\r\n        + \"          name\"\r\n        + \"        }\"\r\n        + \"      }\"\r\n        + \"    }\"\r\n        + \"  }\"\r\n        + \"}\";\r\n\r\n        String queryString = \r\n        \"{\"\r\n        + \"  testObj {\"\r\n        + \"    recursionLevel\"\r\n        + \"    recursive {\"\r\n        + \"      recursionLevel\"\r\n        + \"    recursive {\"\r\n        + \"      recursionLevel\"\r\n        + \"    recursive {\"\r\n        + \"      recursionLevel\"\r\n        + \"    recursive {\"\r\n        + \"      recursionLevel\"\r\n        + \"    }\"\r\n        + \"    }\"\r\n        + \"    }\"\r\n        + \"    }\"\r\n        + \"  }\"\r\n        + \"}\";\r\n        \r\n        try {\r\n            new GraphQL(recursiveTestSchema).execute(query);\r\n        }\r\n        catch (Exception e) {\r\n            logger.error(\"Caught exception\", e);\r\n            throw e;\r\n        }\r\n        ExecutionResult queryResult = new GraphQL(recursiveTestSchema).execute(query);\r\n        assertThat(queryResult.getErrors(), is(empty()));\r\n```\r\n\r\n```\r\npublic class RecursiveClass {\r\n    public RecursiveClass() {\r\n        \r\n    }\r\n    \r\n    public RecursiveClass(int recursionLevel) {\r\n        this.recursionLevel = String.valueOf(recursionLevel);\r\n        if (recursionLevel > 0 && recursionLevel < 10) {\r\n            recursive = new RecursiveClass(recursionLevel - 1);\r\n        }\r\n    }\r\n\r\n    public String getRecursionLevel() {\r\n        return recursionLevel;\r\n    }\r\n    public RecursiveClass getRecursive() {\r\n        return recursive;\r\n    }\r\n\r\n    public String recursionLevel;\r\n    public RecursiveClass recursive = null;\r\n```"}}