{"action":"created","issue":{"url":"https://api.github.com/repos/graphql-python/graphene/issues/49","labels_url":"https://api.github.com/repos/graphql-python/graphene/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/graphql-python/graphene/issues/49/comments","events_url":"https://api.github.com/repos/graphql-python/graphene/issues/49/events","html_url":"https://github.com/graphql-python/graphene/issues/49","id":118730395,"number":49,"title":"Help with Mutation","user":{"login":"amitsaha","id":512598,"avatar_url":"https://avatars.githubusercontent.com/u/512598?v=3","gravatar_id":"","url":"https://api.github.com/users/amitsaha","html_url":"https://github.com/amitsaha","followers_url":"https://api.github.com/users/amitsaha/followers","following_url":"https://api.github.com/users/amitsaha/following{/other_user}","gists_url":"https://api.github.com/users/amitsaha/gists{/gist_id}","starred_url":"https://api.github.com/users/amitsaha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amitsaha/subscriptions","organizations_url":"https://api.github.com/users/amitsaha/orgs","repos_url":"https://api.github.com/users/amitsaha/repos","events_url":"https://api.github.com/users/amitsaha/events{/privacy}","received_events_url":"https://api.github.com/users/amitsaha/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-25T00:05:48Z","updated_at":"2015-11-25T01:02:18Z","closed_at":null,"body":"Hello, I am trying to experiment with a simple mutation, here is my schema:\r\n\r\n```\r\nimport graphene\r\n\r\n\r\nclass Person(graphene.ObjectType):\r\n\r\n    name = graphene.String()\r\n    age = graphene.Float()\r\n    id = graphene.Int()\r\n\r\n# Database of Person(s)\r\np1 = Person()\r\np2 = Person()\r\n\r\np1.id = 1\r\np1.age = 34\r\np1.name = 'Jack'\r\n\r\np2.id = 2\r\np2.age = 31\r\np2.name = 'Adam'\r\n\r\npersons = [p1, p2]\r\n\r\nclass Query(graphene.ObjectType):\r\n\r\n    # Create a field on which we can query and the attributes\r\n    # we allow to query on\r\n    person = graphene.Field(Person, id=graphene.Int())\r\n    def resolve_person(self, args, info):\r\n        for p in persons:\r\n            if p.id == args.get('id'):\r\n                return p\r\n\r\nclass UpdatePerson(graphene.Mutation):\r\n    # Result field\r\n    # XXX: This doesn't work\r\n    # person = graphene.Field(Person)\r\n\r\n    # This does work\r\n    person = graphene.String()\r\n\r\n    # The input fields\r\n    class Input:\r\n        name = graphene.String()\r\n        id = graphene.Int()\r\n\r\n    @classmethod\r\n    def mutate(cls, instance, args, info):\r\n        name = args.get('name')\r\n        for p in persons:\r\n            if p.id == args.get('id'):\r\n                p.name = name\r\n                return UpdatePerson(person=p.name)\r\n\r\nclass UpdatePersonMutation(graphene.ObjectType):\r\n    updatePerson = graphene.Field(UpdatePerson)\r\n\r\nschema = graphene.Schema(query=Query, mutation=UpdatePersonMutation)\r\n\r\n```\r\n\r\nIn ``UpdatePerson`` above, when I have the person field as ``person = graphene.Field(Person)``, ( and correspondingly ``return UpdatePerson(person=p)``), upon sending a mutation query, I get: ``[GraphQLError('Field \"person\" of type \"Person\" must have a sub selection.',)]``. \r\n\r\nAny suggestions as to what I am doing wrong?\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/graphql-python/graphene/issues/comments/159452403","html_url":"https://github.com/graphql-python/graphene/issues/49#issuecomment-159452403","issue_url":"https://api.github.com/repos/graphql-python/graphene/issues/49","id":159452403,"user":{"login":"jhgg","id":5489149,"avatar_url":"https://avatars.githubusercontent.com/u/5489149?v=3","gravatar_id":"","url":"https://api.github.com/users/jhgg","html_url":"https://github.com/jhgg","followers_url":"https://api.github.com/users/jhgg/followers","following_url":"https://api.github.com/users/jhgg/following{/other_user}","gists_url":"https://api.github.com/users/jhgg/gists{/gist_id}","starred_url":"https://api.github.com/users/jhgg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhgg/subscriptions","organizations_url":"https://api.github.com/users/jhgg/orgs","repos_url":"https://api.github.com/users/jhgg/repos","events_url":"https://api.github.com/users/jhgg/events{/privacy}","received_events_url":"https://api.github.com/users/jhgg/received_events","type":"User","site_admin":false},"created_at":"2015-11-25T01:02:18Z","updated_at":"2015-11-25T01:02:18Z","body":"Chances are you are calling:\r\n\r\n```\r\nmutation { \r\n    updatePerson(id: 5, name: \"Hello\") {\r\n        person\r\n    }\r\n}\r\n```\r\n\r\nYou should be calling:\r\n\r\n```\r\nmutation { \r\n    updatePerson(id: 5, name: \"Hello\") {\r\n        person {\r\n            id\r\n            name\r\n        }\r\n    }\r\n}\r\n```"}}