GraphQL Error: “Expected Iterable, but did not find one for field Query” when fetching data from CryptoCompare API Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!GraphQL Expected Iterable, but did not find one for field xxx.yyyGraphQL Expected Iterable, but did not find one for field xxx.yyyRoot Methods for GraphQL Sub Field QueriesGraphQL - fetch a field conditionallyHow to fetch query in graphql?GraphQL Expected Iterable, but did not find one for field while using findError: Expected [object Object] to be a GraphQL typeGet localized data from multilingual schema with GraphQL queryApollo-react query returns null when GraphiQL returns dataExpected Iterable but did not find one for field
Is there a verb for listening stealthily?
tabularx column has extra padding at right?
Like totally amazing interchangeable sister outfit accessory swapping or whatever
Can Deduction Guide have an explicit(bool) specifier?
Why did Bronn offer to be Tyrion Lannister's champion in trial by combat?
IC on Digikey is 5x more expensive than board containing same IC on Alibaba: How?
Is it OK if I do not take the receipt in Germany?
Kepler's 3rd law: ratios don't fit data
How to get a single big right brace?
BV functions and wave equation
How do I deal with an erroneously large refund?
Is my guitar’s action too high?
Can this water damage be explained by lack of gutters and grading issues?
Why does BitLocker not use RSA?
Who can become a wight?
Can gravitational waves pass through a black hole?
When does Bran Stark remember Jamie pushing him?
How to break 信じようとしていただけかも知れない into separate parts?
lm and glm function in R
Are bags of holding fireproof?
Can I ask an author to send me his ebook?
Raising a bilingual kid. When should we introduce the majority language?
Why not use the yoke to control yaw, as well as pitch and roll?
Can a Wizard take the Magic Initiate feat and select spells from the Wizard list?
GraphQL Error: “Expected Iterable, but did not find one for field Query” when fetching data from CryptoCompare API
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!GraphQL Expected Iterable, but did not find one for field xxx.yyyGraphQL Expected Iterable, but did not find one for field xxx.yyyRoot Methods for GraphQL Sub Field QueriesGraphQL - fetch a field conditionallyHow to fetch query in graphql?GraphQL Expected Iterable, but did not find one for field while using findError: Expected [object Object] to be a GraphQL typeGet localized data from multilingual schema with GraphQL queryApollo-react query returns null when GraphiQL returns dataExpected Iterable but did not find one for field
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm using GraphQL/express/express-graphql/axios to retrieve specific coin data from the CryptoCompare API.
I have two endpoints:
1) https://min-api.cryptocompare.com/data/pricemultifull?fsyms=BTC,ETH,LTC,BCH,NEO,ETC,XMR&tsyms=USD
From endpoint 1, I want to retrieve the following in USD for 8 coins:
- FROMSYMBOL, CHANGEPCT24HOUR, PRICE, MKTCAP, TOTALVOLUME24HTO
2) https://min-api.cryptocompare.com/data/coin/generalinfo?fsyms=BTC&tsym=USD
From endpoint 2, I want to retrieve the following just for Bitcoin/BTC:
- Id, FullName, ImageUrl
I have setup my backend server with two files, as well as testing queries using graphiql.
File 1 - server.js
const express = require("express")
const graphqlHTTP = require("express-graphql")
const cors = require("cors")
const schema = require("./schema")
const app = express()
app.use(cors())
app.use(
"/graphql",
graphqlHTTP(
schema,
graphiql: true
)
)
const PORT = process.env.PORT || 4000
app.listen(PORT, console.log(`✅ Listening to port $PORT`))
File 2 - schema.js
const
GraphQLObjectType,
GraphQLList,
GraphQLID,
GraphQLInt,
GraphQLString,
GraphQLSchema
= require("graphql")
const axios = require("axios")
const CoinDataType = new GraphQLObjectType(
name: "CoinData",
fields: () => (
FROMSYMBOL: type: GraphQLString ,
CHANGEPCT24HOUR: type: GraphQLInt ,
PRICE: type: GraphQLInt ,
MKTCAP: type: GraphQLInt ,
TOTALVOLUME24HTO: type: GraphQLInt
)
)
const CoinInfoType = new GraphQLObjectType(
name: "CoinInfo",
fields: () => (
Id: type: GraphQLID ,
FullName: type: GraphQLString ,
ImageUrl: type: GraphQLString
)
)
const Query = new GraphQLObjectType(
name: "Query",
fields:
CoinData:
type: new GraphQLList(CoinDataType),
resolve(parent, args)
return axios
.get(
"https://min-api.cryptocompare.com/data/pricemultifull?fsyms=BTC,ETH,LTC,BCH,NEO,ETC,XMR&tsyms=USD"
)
.then(res => res.data)
,
CoinInfo:
type: new GraphQLList(CoinInfoType),
resolve(parent, args)
return axios
.get(
"https://min-api.cryptocompare.com/data/coin/generalinfo?fsyms=BTC&tsym=USD"
)
.then(res => res.data)
)
module.exports = new GraphQLSchema( query: Query )
When I use graphiql to test my queries with this:
CoinData
FROMSYMBOL
CoinInfo
Id
...I get this error:
"errors": [
"message": "Expected Iterable, but did not find one for field Query.CoinInfo.",
"locations": [
"line": 5,
"column": 3
],
"path": [
"CoinInfo"
]
,
"message": "Expected Iterable, but did not find one for field Query.CoinData.",
"locations": [
"line": 2,
"column": 3
],
"path": [
"CoinData"
]
],
"data":
"CoinData": null,
"CoinInfo": null
How do I get around this error? Thanks.
graphql express-graphql graphiql
add a comment |
I'm using GraphQL/express/express-graphql/axios to retrieve specific coin data from the CryptoCompare API.
I have two endpoints:
1) https://min-api.cryptocompare.com/data/pricemultifull?fsyms=BTC,ETH,LTC,BCH,NEO,ETC,XMR&tsyms=USD
From endpoint 1, I want to retrieve the following in USD for 8 coins:
- FROMSYMBOL, CHANGEPCT24HOUR, PRICE, MKTCAP, TOTALVOLUME24HTO
2) https://min-api.cryptocompare.com/data/coin/generalinfo?fsyms=BTC&tsym=USD
From endpoint 2, I want to retrieve the following just for Bitcoin/BTC:
- Id, FullName, ImageUrl
I have setup my backend server with two files, as well as testing queries using graphiql.
File 1 - server.js
const express = require("express")
const graphqlHTTP = require("express-graphql")
const cors = require("cors")
const schema = require("./schema")
const app = express()
app.use(cors())
app.use(
"/graphql",
graphqlHTTP(
schema,
graphiql: true
)
)
const PORT = process.env.PORT || 4000
app.listen(PORT, console.log(`✅ Listening to port $PORT`))
File 2 - schema.js
const
GraphQLObjectType,
GraphQLList,
GraphQLID,
GraphQLInt,
GraphQLString,
GraphQLSchema
= require("graphql")
const axios = require("axios")
const CoinDataType = new GraphQLObjectType(
name: "CoinData",
fields: () => (
FROMSYMBOL: type: GraphQLString ,
CHANGEPCT24HOUR: type: GraphQLInt ,
PRICE: type: GraphQLInt ,
MKTCAP: type: GraphQLInt ,
TOTALVOLUME24HTO: type: GraphQLInt
)
)
const CoinInfoType = new GraphQLObjectType(
name: "CoinInfo",
fields: () => (
Id: type: GraphQLID ,
FullName: type: GraphQLString ,
ImageUrl: type: GraphQLString
)
)
const Query = new GraphQLObjectType(
name: "Query",
fields:
CoinData:
type: new GraphQLList(CoinDataType),
resolve(parent, args)
return axios
.get(
"https://min-api.cryptocompare.com/data/pricemultifull?fsyms=BTC,ETH,LTC,BCH,NEO,ETC,XMR&tsyms=USD"
)
.then(res => res.data)
,
CoinInfo:
type: new GraphQLList(CoinInfoType),
resolve(parent, args)
return axios
.get(
"https://min-api.cryptocompare.com/data/coin/generalinfo?fsyms=BTC&tsym=USD"
)
.then(res => res.data)
)
module.exports = new GraphQLSchema( query: Query )
When I use graphiql to test my queries with this:
CoinData
FROMSYMBOL
CoinInfo
Id
...I get this error:
"errors": [
"message": "Expected Iterable, but did not find one for field Query.CoinInfo.",
"locations": [
"line": 5,
"column": 3
],
"path": [
"CoinInfo"
]
,
"message": "Expected Iterable, but did not find one for field Query.CoinData.",
"locations": [
"line": 2,
"column": 3
],
"path": [
"CoinData"
]
],
"data":
"CoinData": null,
"CoinInfo": null
How do I get around this error? Thanks.
graphql express-graphql graphiql
Duplicate of GraphQL Expected Iterable, but did not find one for field xxx.yyy. What's returned in your resolver needs to match the type for the field.
– Daniel Rearden
Mar 22 at 17:36
Ah, I see, that makes sense. For example, in CoinInfoType, I have three fields I want to retrieve: Id/FullName/ImageUrl, but from the endpoint min-api.cryptocompare.com/data/coin/…, those fields are nested within the Data array -> CoinData object. How can I rewrite my schema to access the data? Thanks.
– user10013590
Mar 22 at 17:44
No need to rewrite your schema -- just manipulate the data returned by the API before returning it inside your resolver
– Daniel Rearden
Mar 22 at 17:55
CoinInfo: type: new GraphQLList(CoinInfoType), resolve(parent, args) return axios .get( "min-api.cryptocompare.com/data/coin/…" ) .then(res => res.data) .then(res => res.Data.map(coin => return Id: coin.CoinInfo.Id, FullName: coin.CoinInfo.FullName, ImageUrl: coin.CoinInfo.ImageUrl ) ) This worked, but is there a more concise way?
– user10013590
Mar 22 at 18:16
add a comment |
I'm using GraphQL/express/express-graphql/axios to retrieve specific coin data from the CryptoCompare API.
I have two endpoints:
1) https://min-api.cryptocompare.com/data/pricemultifull?fsyms=BTC,ETH,LTC,BCH,NEO,ETC,XMR&tsyms=USD
From endpoint 1, I want to retrieve the following in USD for 8 coins:
- FROMSYMBOL, CHANGEPCT24HOUR, PRICE, MKTCAP, TOTALVOLUME24HTO
2) https://min-api.cryptocompare.com/data/coin/generalinfo?fsyms=BTC&tsym=USD
From endpoint 2, I want to retrieve the following just for Bitcoin/BTC:
- Id, FullName, ImageUrl
I have setup my backend server with two files, as well as testing queries using graphiql.
File 1 - server.js
const express = require("express")
const graphqlHTTP = require("express-graphql")
const cors = require("cors")
const schema = require("./schema")
const app = express()
app.use(cors())
app.use(
"/graphql",
graphqlHTTP(
schema,
graphiql: true
)
)
const PORT = process.env.PORT || 4000
app.listen(PORT, console.log(`✅ Listening to port $PORT`))
File 2 - schema.js
const
GraphQLObjectType,
GraphQLList,
GraphQLID,
GraphQLInt,
GraphQLString,
GraphQLSchema
= require("graphql")
const axios = require("axios")
const CoinDataType = new GraphQLObjectType(
name: "CoinData",
fields: () => (
FROMSYMBOL: type: GraphQLString ,
CHANGEPCT24HOUR: type: GraphQLInt ,
PRICE: type: GraphQLInt ,
MKTCAP: type: GraphQLInt ,
TOTALVOLUME24HTO: type: GraphQLInt
)
)
const CoinInfoType = new GraphQLObjectType(
name: "CoinInfo",
fields: () => (
Id: type: GraphQLID ,
FullName: type: GraphQLString ,
ImageUrl: type: GraphQLString
)
)
const Query = new GraphQLObjectType(
name: "Query",
fields:
CoinData:
type: new GraphQLList(CoinDataType),
resolve(parent, args)
return axios
.get(
"https://min-api.cryptocompare.com/data/pricemultifull?fsyms=BTC,ETH,LTC,BCH,NEO,ETC,XMR&tsyms=USD"
)
.then(res => res.data)
,
CoinInfo:
type: new GraphQLList(CoinInfoType),
resolve(parent, args)
return axios
.get(
"https://min-api.cryptocompare.com/data/coin/generalinfo?fsyms=BTC&tsym=USD"
)
.then(res => res.data)
)
module.exports = new GraphQLSchema( query: Query )
When I use graphiql to test my queries with this:
CoinData
FROMSYMBOL
CoinInfo
Id
...I get this error:
"errors": [
"message": "Expected Iterable, but did not find one for field Query.CoinInfo.",
"locations": [
"line": 5,
"column": 3
],
"path": [
"CoinInfo"
]
,
"message": "Expected Iterable, but did not find one for field Query.CoinData.",
"locations": [
"line": 2,
"column": 3
],
"path": [
"CoinData"
]
],
"data":
"CoinData": null,
"CoinInfo": null
How do I get around this error? Thanks.
graphql express-graphql graphiql
I'm using GraphQL/express/express-graphql/axios to retrieve specific coin data from the CryptoCompare API.
I have two endpoints:
1) https://min-api.cryptocompare.com/data/pricemultifull?fsyms=BTC,ETH,LTC,BCH,NEO,ETC,XMR&tsyms=USD
From endpoint 1, I want to retrieve the following in USD for 8 coins:
- FROMSYMBOL, CHANGEPCT24HOUR, PRICE, MKTCAP, TOTALVOLUME24HTO
2) https://min-api.cryptocompare.com/data/coin/generalinfo?fsyms=BTC&tsym=USD
From endpoint 2, I want to retrieve the following just for Bitcoin/BTC:
- Id, FullName, ImageUrl
I have setup my backend server with two files, as well as testing queries using graphiql.
File 1 - server.js
const express = require("express")
const graphqlHTTP = require("express-graphql")
const cors = require("cors")
const schema = require("./schema")
const app = express()
app.use(cors())
app.use(
"/graphql",
graphqlHTTP(
schema,
graphiql: true
)
)
const PORT = process.env.PORT || 4000
app.listen(PORT, console.log(`✅ Listening to port $PORT`))
File 2 - schema.js
const
GraphQLObjectType,
GraphQLList,
GraphQLID,
GraphQLInt,
GraphQLString,
GraphQLSchema
= require("graphql")
const axios = require("axios")
const CoinDataType = new GraphQLObjectType(
name: "CoinData",
fields: () => (
FROMSYMBOL: type: GraphQLString ,
CHANGEPCT24HOUR: type: GraphQLInt ,
PRICE: type: GraphQLInt ,
MKTCAP: type: GraphQLInt ,
TOTALVOLUME24HTO: type: GraphQLInt
)
)
const CoinInfoType = new GraphQLObjectType(
name: "CoinInfo",
fields: () => (
Id: type: GraphQLID ,
FullName: type: GraphQLString ,
ImageUrl: type: GraphQLString
)
)
const Query = new GraphQLObjectType(
name: "Query",
fields:
CoinData:
type: new GraphQLList(CoinDataType),
resolve(parent, args)
return axios
.get(
"https://min-api.cryptocompare.com/data/pricemultifull?fsyms=BTC,ETH,LTC,BCH,NEO,ETC,XMR&tsyms=USD"
)
.then(res => res.data)
,
CoinInfo:
type: new GraphQLList(CoinInfoType),
resolve(parent, args)
return axios
.get(
"https://min-api.cryptocompare.com/data/coin/generalinfo?fsyms=BTC&tsym=USD"
)
.then(res => res.data)
)
module.exports = new GraphQLSchema( query: Query )
When I use graphiql to test my queries with this:
CoinData
FROMSYMBOL
CoinInfo
Id
...I get this error:
"errors": [
"message": "Expected Iterable, but did not find one for field Query.CoinInfo.",
"locations": [
"line": 5,
"column": 3
],
"path": [
"CoinInfo"
]
,
"message": "Expected Iterable, but did not find one for field Query.CoinData.",
"locations": [
"line": 2,
"column": 3
],
"path": [
"CoinData"
]
],
"data":
"CoinData": null,
"CoinInfo": null
How do I get around this error? Thanks.
graphql express-graphql graphiql
graphql express-graphql graphiql
asked Mar 22 at 13:59
user10013590
Duplicate of GraphQL Expected Iterable, but did not find one for field xxx.yyy. What's returned in your resolver needs to match the type for the field.
– Daniel Rearden
Mar 22 at 17:36
Ah, I see, that makes sense. For example, in CoinInfoType, I have three fields I want to retrieve: Id/FullName/ImageUrl, but from the endpoint min-api.cryptocompare.com/data/coin/…, those fields are nested within the Data array -> CoinData object. How can I rewrite my schema to access the data? Thanks.
– user10013590
Mar 22 at 17:44
No need to rewrite your schema -- just manipulate the data returned by the API before returning it inside your resolver
– Daniel Rearden
Mar 22 at 17:55
CoinInfo: type: new GraphQLList(CoinInfoType), resolve(parent, args) return axios .get( "min-api.cryptocompare.com/data/coin/…" ) .then(res => res.data) .then(res => res.Data.map(coin => return Id: coin.CoinInfo.Id, FullName: coin.CoinInfo.FullName, ImageUrl: coin.CoinInfo.ImageUrl ) ) This worked, but is there a more concise way?
– user10013590
Mar 22 at 18:16
add a comment |
Duplicate of GraphQL Expected Iterable, but did not find one for field xxx.yyy. What's returned in your resolver needs to match the type for the field.
– Daniel Rearden
Mar 22 at 17:36
Ah, I see, that makes sense. For example, in CoinInfoType, I have three fields I want to retrieve: Id/FullName/ImageUrl, but from the endpoint min-api.cryptocompare.com/data/coin/…, those fields are nested within the Data array -> CoinData object. How can I rewrite my schema to access the data? Thanks.
– user10013590
Mar 22 at 17:44
No need to rewrite your schema -- just manipulate the data returned by the API before returning it inside your resolver
– Daniel Rearden
Mar 22 at 17:55
CoinInfo: type: new GraphQLList(CoinInfoType), resolve(parent, args) return axios .get( "min-api.cryptocompare.com/data/coin/…" ) .then(res => res.data) .then(res => res.Data.map(coin => return Id: coin.CoinInfo.Id, FullName: coin.CoinInfo.FullName, ImageUrl: coin.CoinInfo.ImageUrl ) ) This worked, but is there a more concise way?
– user10013590
Mar 22 at 18:16
Duplicate of GraphQL Expected Iterable, but did not find one for field xxx.yyy. What's returned in your resolver needs to match the type for the field.
– Daniel Rearden
Mar 22 at 17:36
Duplicate of GraphQL Expected Iterable, but did not find one for field xxx.yyy. What's returned in your resolver needs to match the type for the field.
– Daniel Rearden
Mar 22 at 17:36
Ah, I see, that makes sense. For example, in CoinInfoType, I have three fields I want to retrieve: Id/FullName/ImageUrl, but from the endpoint min-api.cryptocompare.com/data/coin/…, those fields are nested within the Data array -> CoinData object. How can I rewrite my schema to access the data? Thanks.
– user10013590
Mar 22 at 17:44
Ah, I see, that makes sense. For example, in CoinInfoType, I have three fields I want to retrieve: Id/FullName/ImageUrl, but from the endpoint min-api.cryptocompare.com/data/coin/…, those fields are nested within the Data array -> CoinData object. How can I rewrite my schema to access the data? Thanks.
– user10013590
Mar 22 at 17:44
No need to rewrite your schema -- just manipulate the data returned by the API before returning it inside your resolver
– Daniel Rearden
Mar 22 at 17:55
No need to rewrite your schema -- just manipulate the data returned by the API before returning it inside your resolver
– Daniel Rearden
Mar 22 at 17:55
CoinInfo: type: new GraphQLList(CoinInfoType), resolve(parent, args) return axios .get( "min-api.cryptocompare.com/data/coin/…" ) .then(res => res.data) .then(res => res.Data.map(coin => return Id: coin.CoinInfo.Id, FullName: coin.CoinInfo.FullName, ImageUrl: coin.CoinInfo.ImageUrl ) ) This worked, but is there a more concise way?
– user10013590
Mar 22 at 18:16
CoinInfo: type: new GraphQLList(CoinInfoType), resolve(parent, args) return axios .get( "min-api.cryptocompare.com/data/coin/…" ) .then(res => res.data) .then(res => res.Data.map(coin => return Id: coin.CoinInfo.Id, FullName: coin.CoinInfo.FullName, ImageUrl: coin.CoinInfo.ImageUrl ) ) This worked, but is there a more concise way?
– user10013590
Mar 22 at 18:16
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55301252%2fgraphql-error-expected-iterable-but-did-not-find-one-for-field-query-when-fe%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55301252%2fgraphql-error-expected-iterable-but-did-not-find-one-for-field-query-when-fe%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Duplicate of GraphQL Expected Iterable, but did not find one for field xxx.yyy. What's returned in your resolver needs to match the type for the field.
– Daniel Rearden
Mar 22 at 17:36
Ah, I see, that makes sense. For example, in CoinInfoType, I have three fields I want to retrieve: Id/FullName/ImageUrl, but from the endpoint min-api.cryptocompare.com/data/coin/…, those fields are nested within the Data array -> CoinData object. How can I rewrite my schema to access the data? Thanks.
– user10013590
Mar 22 at 17:44
No need to rewrite your schema -- just manipulate the data returned by the API before returning it inside your resolver
– Daniel Rearden
Mar 22 at 17:55
CoinInfo: type: new GraphQLList(CoinInfoType), resolve(parent, args) return axios .get( "min-api.cryptocompare.com/data/coin/…" ) .then(res => res.data) .then(res => res.Data.map(coin => return Id: coin.CoinInfo.Id, FullName: coin.CoinInfo.FullName, ImageUrl: coin.CoinInfo.ImageUrl ) ) This worked, but is there a more concise way?
– user10013590
Mar 22 at 18:16