Skip to content

Commit 9dce586

Browse files
authored
Update plugin option schema validation code sample (#28904)
* Update configuring-usage-with-plugin-options.md The testPluginOptionsSchema returns promise. * Add mention about Kontent implementation
1 parent 5f0d214 commit 9dce586

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/docs/how-to/plugins-and-themes/configuring-usage-with-plugin-options.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,13 @@ import { testPluginOptionsSchema } from "gatsby-plugin-utils"
240240
import { pluginOptionsSchema } from "../gatsby-node"
241241

242242
describe(`pluginOptionsSchema`, () => {
243-
it(`should invalidate incorrect options`, () => {
243+
it(`should invalidate incorrect options`, async () => {
244244
const options = {
245245
optionA: undefined, // Should be a boolean
246246
message: 123, // Should be a string
247247
optionB: `not a boolean`, // Should be a boolean
248248
}
249-
const { isValid, errors } = testPluginOptionsSchema(
249+
const { isValid, errors } = await testPluginOptionsSchema(
250250
pluginOptionsSchema,
251251
options
252252
)
@@ -259,13 +259,13 @@ describe(`pluginOptionsSchema`, () => {
259259
])
260260
})
261261

262-
it(`should validate correct options`, () => {
262+
it(`should validate correct options`, async () => {
263263
const options = {
264264
optionA: false,
265265
message: "string",
266266
optionB: true,
267267
}
268-
const { isValid, errors } = testPluginOptionsSchema(
268+
const { isValid, errors } = await testPluginOptionsSchema(
269269
pluginOptionsSchema,
270270
options
271271
)
@@ -281,3 +281,4 @@ describe(`pluginOptionsSchema`, () => {
281281
- [Example Gatsby site using plugin options with a local plugin](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-plugin-options)
282282
- [Joi API documentation](https://joi.dev/api/)
283283
- [`pluginOptionsSchema` for the Contentful source plugin](https://github.com/gatsbyjs/gatsby/blob/af973d4647dc14c85555a2ad8f1aff08028ee3b7/packages/gatsby-source-contentful/src/gatsby-node.js#L75-L159)
284+
- [`pluginOptionsSchema` for the Kontent source plugin](https://github.com/Kentico/kontent-gatsby-packages/blob/master/packages/gatsby-source-kontent/src/pluginOptionsSchema.ts#L2-L35)

0 commit comments

Comments
 (0)