A.K.A. Those are bad practices / antipaterns
Function based resolvers
Function based resolvers
query {
authors{
id
name
}
}
{
id: 0,
name: 'Arthur',
tweets: () => getTweets([0,1])
},
{
id:1,
name: 'Bob',
tweets: () => getTweets([2)]
}
Function based resolvers
query {
authors{
id
name
tweets{
id
text
}
}
{
id: 0,
name: 'Arthur',
tweets: () => getTweets([0,1])
},
{
id:1,
name: 'Bob',
tweets: () => getTweets([2)]
}
{
id: 0,
text: 'Hello world',
author: () => getUser(0)
},
{
id:1,
text: 'Another one',
author: () => getUser(1)
}
{
id: 2,
text: 'Hello world',
author: () => getUser(1)
}
Circular Objects
query {
authors{
id
name
}
{
id: 0,
name: 'Arthur',
tweets: [ { id: 0, text:'Hello World', author:{...}},
{ id: 1, text: 'Another One', author:{...}]
},
{
id:1,
name: 'Bob',
tweets: [ { id: 2, text:'Hello World', author:{...}}]
},
Graph / Circular Objects
query {
authors{
id
name
tweets{
id
text
}
}
{
id: 0,
name: 'Arthur',
tweets: [ { id: 0, text:'Hello World', author:{...}},
{ id: 1, text: 'Another One', author:{...}]
},
{
id:1,
name: 'Bob',
tweets: [ { id: 2, text:'Hello World', author:{...}}]
},
Graph / Circular Objects