-
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
chore(gatsby-source-contentful): move to pluginOptionsSchema #27322
chore(gatsby-source-contentful): move to pluginOptionsSchema #27322
Conversation
throw new Error(`Fetch call to check Contentful access failed.`) | ||
}) | ||
|
||
return undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this is because there's an early return, but since this isn't a .ts file, I'm not sure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For external fro Joi API doc https://github.com/sideway/joi/blob/master/API.md#anyexternalmethod-description
which can either return a replacement value, undefined to indicate no change, or throw an error.
This looks good to me! whats the deal with test suite errors tho? |
I haven't deleted any of the existing tests for the previous custom validation step yet. 😬 |
I cleaned up the error message to make it clearer, this should be ready to ship as a first MVP! 👍 |
Now that we can rely on https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-utils/src/test-plugin-options-schema.ts maybe it can be a good idea to write tests and provide examples of the way to use it in a concrete case? |
Do we need to wrap exports with the experimental flag? |
Yes for sure! 👍
Yes we should unfortunately because the "does Node API exist" check throws an error in the current version of |
73b979a
to
7ef977c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Looks good to me!
Based on the pluginOptionsSchema support added in #27242 this adds a
pluginOptionsSchema
to gatsby-source-contentful based on the already-existing Joi schema and custom option validation this plugin has.