Showing results for 
Search instead for 
Did you mean: 

How to get Graphql to act like Cypher when creating a node with multiple labels

Node Link

I would like to be able to create a node with 2 different labels, and return properties of that node that come from each label. This is trivial in cypher, but I can't get it to work in graphql. This (pictured) query will create a node with both labels 'User' and IosUser' with properties 'id' and 'model', but I can only return `model`, not `id`.

my type definitions:

type User {
  id: String! @unique(constraintName: "unique_id")

type IosUser @node(additionalLabels: ["User"]){
  model: String!

I tried redefining the 'createIosUsers' mutation with a @cypher directive and got weird errors saying it expected the inputs to be maps, not strings, when they are typed as String. Using this cypher directive:
'CREATE (u:User:IosUser {id: $id, model: $model})
RETURN AS id, u.model AS model'

and got the same error when I tried:
'CREATE (u:User:IosUser {id: $id, model: $model})

he mutation works if I just return 'u' at the end of the cypher directive, but then I still can't return the `id` property from the graphql mutation.

I would like to have some hierarchical structure to my labels, basically just having a 'User' label where the unique id lives, and 'IosUser' and 'AndroidUser' with properties specific to those labels. It seems like graphql doesn't play well with this kind of structure. Is there a better way to implement this kind of idea?