-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
action.createTypes throws 'Type with name "ImageFormat" does not exists' #19210
Comments
#16217 stated a similar error but I don't believe it is related |
so it looks like repro: const { schemaComposer } = require('graphql-compose')
schemaComposer.addTypeDefs(`
type Image {
random(format: ImageFormat = JPG): String
}
enum ImageFormat {
JPG
}
`) the above works without the default field value. it also works when the enum is defined first. i guess this needs to be fixed upstream -- in the meantime you could exclude the types owned by |
also, interestingly, it still works with |
and one more issue: some of |
Thanks a lot for taking a look @stefanprobst. This issue is more difficult to demo in a simple project like the one above so bare with me please. Unknown field 'childMarkdownRemark' on type 'contentfulBlockFreeTextMainTextNode'. Source: document `BlockFreeText` file: `GraphQL request` The interesting parts of the schema is: type MarkdownRemark implements Node @childOf(mimeTypes: ["text/markdown", "text/x-markdown"], types: [], many: false) @dontInfer {
frontmatter: MarkdownRemarkFrontmatter
excerpt: String
rawMarkdownBody: String
}
type ContentfulBlockFreeText implements Node @dontInfer {
name: String
section: [ContentfulSection] @link(by: "id", from: "section___NODE")
main: contentfulBlockFreeTextMainTextNode @link(by: "id", from: "main___NODE")
style: contentfulBlockFreeTextStyleJsonNode @link(by: "id", from: "style___NODE")
spaceId: String
contentful_id: String
createdAt: Date @dateformat
updatedAt: Date @dateformat
node_locale: String
page: [ContentfulPage] @link(by: "id", from: "page___NODE")
options: contentfulBlockFreeTextOptionsJsonNode @link(by: "id", from: "options___NODE")
}
type contentfulBlockFreeTextMainTextNode implements Node @dontInfer {
main: String
} It seems to be related to a warning I get in the console about gatsby V3: warn On types with the `@dontInfer` directive, or with the `infer` extension set to `false`, automatically adding fields for children types is deprecated.
In Gatsby v3, only children fields explicitly set with the `childOf` extension will be added.
For example, in Gatsby v3, `contentfulBlockFreeTextMainTextNode` will not get a `childMarkdownRemark` field. Can I manually change my schema somehow to try and correct the problem? |
@stefanprobst fixed in [email protected] and [email protected] |
@nodkz thanks so much for the quick fix! |
Published in [email protected] |
Concurred! Thanks everyone! @stefanprobst I will open another issue with the next one I get. Can you help me make a better case for it by providing some pointers as to what to look for to identify the problem? For example, I don't know if the issue could be related to the Contentful plugin or the transformer remark or simply the |
Demo repo
Netlify log
Description
I created a schema with
actions.printTypeDefinitions
. Here is part of the output:Full schema
When I try to use this schema with
it throws with the following stack trace:
I am not an expert with graphQL so I am lost.
My only clue is that
ImageFormat
is not aType
but anenum
. Maybe we don't look forenum
s thereforeImageFormat
is not found at all and throws???Steps to reproduce
gatsby-plugin-schema-snapshot
or the following snippet in yourgatsby-node.js
Expected result
We should be able to seamlessly use the schema we just created.
Actual result
Throws error
Environment
Note: modified gatsby to resolve bug stated in #19191
The text was updated successfully, but these errors were encountered: