The documentation for createPages does not specify the parameters that createPages receives. Some of those parameters are glossed over in the example (actions), and some are omitted (reporter).
Since this is an API reference page (rather than the corresponding guide), I think the parameters should be comprehensively listed and documented.
My particular motivation was to drill into the documentation for the graphql parameter and see if there was any way I could pass a context, in order to make authenticated GraphQL queries from gatsby-node. I couldn't figure out where the documentation for the graphql instance lives.
On the same page, createResolvers has a proper list of parameters.
You are right. We have separate page for arguments that are shared in all gatsby-node hooks ( https://www.gatsbyjs.org/docs/node-api-helpers/ ) but we don't reference it in actual gatsby-node API reference page.
It would be cumbersome to give full list of those for each hook, but we should have a note for each hook to check those shred ones + document any hook specific args (like graphql for createPages)
Also for reference - we generate API reference page from https://github.com/gatsbyjs/gatsby/blob/067468ac1043be3815683dd76c269f384b317ead/packages/gatsby/src/utils/api-node-docs.ts (and this is why createResolvers have params documented and createPages doesn't (because we don't have any @param jsdoc annotations in most of hooks)
Hiya!
This issue has gone quiet. Spooky quiet. 馃懟
We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks for being a part of the Gatsby community! 馃挭馃挏
Hiya!
This issue has gone quiet. Spooky quiet. 馃懟
We get a lot of issues, so we currently close issues after 60 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks for being a part of the Gatsby community! 馃挭馃挏
Adding some details so that hopefully this can be picked up by a community contributor for Hacktoberfest.
docs/docs/node-apis.md) about the shared arguments for all gatsby-node hooks.graphql to the jsdoc annotation for createPages (in gatsby/packages/gatsby/src/utils/api-node-docs.ts).could I work on this issue?
Hi @meganesu!!!
I'd like to work on this issue.
@veerreshr since you commented first, I'm going to assign this issue to you.
@kalzen15, thanks for your interest. We'd love to have you contribute on another one of our open issues!
Let me know if either of you have any questions!
@veerreshr Do you still have time to work on this? If not, I'd like to.
@davad since there hasn't been a response from @veerreshr, I'm going to go ahead an unassign them and assign this issue to you instead. Feel free to reach out if you have any questions!
Hi @meganesu !
I would like to work on this issue if @davad isn't :pray:
Haha, give me a few more days @leonardotdleal :).
I'm submitting a PR in a sec. There are a ton of props that are passed into the createPages call that we probably don't need to document.
I'm documenting actions, ~basePath,~ graphql, ~pathPrefix,~ and reporter. Are there any others we should include?
Edit: Not including basePath or pathPrefix because they seem confusing to explain and I'm not sure if users will get much use out of them.
You can see the full object being constructed as apiCallArgs in /src/utils/api-runner-node.js (line 369 right now).
Here's the full object I see from a test run:
{traceId: "initial-createPages", waitForCascadingActions: true, parentSpan: Span, deferNodeMutation: true, graphql: 茠, 鈥
actions: {deletePage: 茠, createPage: 茠, deleteNode: 茠, deleteNodes: 茠, createNode: 茠, 鈥
basePath: ""
boundActionCreators: {deletePage: 茠, createPage: 茠, deleteNode: 茠, deleteNodes: 茠, createNode: 茠, 鈥
cache: Cache {name: "default-site-plugin", store: {鈥, cache: {鈥}
createContentDigest: input => {鈥
createNodeId: id => (0, _createNodeId.createNodeId)(id, plugin.name)
deferNodeMutation: true
emitter: {on: 茠, off: 茠, emit: 茠}
getCache: name => {鈥
getNode: id => _.store.getState().nodes.get(id)
getNodeAndSavePathDependency: (id, path) => {鈥
getNodes: () => {鈥
getNodesByType: type => {鈥
graphql: (query, context) => {鈥
hasNodeChanged: (id, digest) => {鈥
loadNodeContent: async 茠 loadNodeContent(node)
parentSpan: Span {}
pathPrefix: ""
reporter: {stripIndent: 茠, format: 茠, setVerbose: 茠, setNoColor: 茠, panic: 茠, 鈥
schema: {buildObjectType: 茠, buildUnionType: 茠, buildInterfaceType: 茠, buildInputObjectType: 茠, buildEnumType: 茠, 鈥
store: {dispatch: 茠, subscribe: 茠, getState: 茠, replaceReducer: 茠, Symbol(observable): 茠}
traceId: "initial-createPages"
tracing: {tracer: GlobalTracerDelegate, parentSpan: Span, startSpan: 茠}
waitForCascadingActions: true
}
Most helpful comment
Haha, give me a few more days @leonardotdleal :).