Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphql: Allow to unnest objects #686

Closed
dennwc opened this issue Jan 29, 2018 · 0 comments
Closed

graphql: Allow to unnest objects #686

dennwc opened this issue Jan 29, 2018 · 0 comments
Milestone

Comments

@dennwc
Copy link
Member

dennwc commented Jan 29, 2018

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}
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant