8000 graphql: Allow to unnest objects · Issue #686 · cayleygraph/cayley · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
graphql: Allow to unnest objects #686
Closed
@dennwc

Description

@dennwc

From discourse thread:

The following query:

{
  nodes(id: spotify:track:6SYdgNzbH6QuFfdlPn3rkc){
    id 
    name 
    artist{name}
  }
}

Produces:

{
	"data": {
		"nodes": {
			"artist": {
				"name": "The Veils"
			},
			"id": "spotify:track:6SYdgNzbH6QuFfdlPn3rkc",
			"name": "Jesus for the Jugular"
		}
	}
}

There should be a way to truncate the results so they are not nested. Something like:

{
	"data": {
		"nodes": {
			"artist": "The Veils",
			"id": "spotify:track:6SYdgNzbH6QuFfdlPn3rkc",
			"name": "Jesus for the Jugular"
		}
	}
}

An be done with a directive on a parent predicate:

{
  nodes(id: spotify:track:6SYdgNzbH6QuFfdlPn3rkc){
    id 
    name 
    artist @unnest {name}
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0