You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In retrospective this seems like a reasonable behavior, but might be overlooked by other people as well and cost them some time and nerves. I think it's at least worth mentioning in the docs that anonymous operations are counted as documents but omitted / ignored in generation phase.
Having only anonymous queries in the project will not trigger any errors but will result in empty output *.generated.d.ts
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
customers(first: 5, query: "country:canada") {
edges {
node {
id
}
}
}
}`,
});
apart from annotating with magic #graphql tag it also needs a name. So to get graphql-codegen going one will have to change above code to something like:
this also looks like a good place to me, this is where I learned about the graphql-codegen and it will be a nice addition to otherwise complete tutorial.
Overview/summary
In retrospective this seems like a reasonable behavior, but might be overlooked by other people as well and cost them some time and nerves. I think it's at least worth mentioning in the docs that anonymous operations are counted as documents but omitted / ignored in generation phase.
Having only anonymous queries in the project will not trigger any errors but will result in empty output
*.generated.d.ts
Consider such an example straight from Shopify docs (https://shopify.dev/docs/api/admin-graphql/2024-10/queries/customers?language=Node.js):
apart from annotating with magic
#graphql
tag it also needs a name. So to getgraphql-codegen
going one will have to change above code to something like:There's literally only a single mention of this fact in the
graphql-codegen
docs and it's inReact / Vue
chapter (I only found it because I knew what I was looking for): https://the-guild.dev/graphql/codegen/docs/guides/react-vue#writing-graphql-queriesRespective "Vanilla TypeScript" chapter does not contain such a warning.
The text was updated successfully, but these errors were encountered: