mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 16:17:25 +02:00
fix(validation): improve error messages for a few schemas (#6997)
* fix(validation): improve error messages for a few schemas * kick CI * fix test
This commit is contained in:
parent
d879cdca96
commit
f1bcdbff63
6 changed files with 114 additions and 44 deletions
|
@ -28,15 +28,35 @@ exports[`validation schemas pluginIdSchema: for value=null 1`] = `"\\"value\\" m
|
|||
|
||||
exports[`validation schemas pluginIdSchema: for value=true 1`] = `"\\"value\\" must be a string"`;
|
||||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[[]] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[[]] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[[null,null]] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[[null,null]] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[3] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[3] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[false] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[false] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[null] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[null] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=3 1`] = `"\\"value\\" must be an array"`;
|
||||
|
||||
|
@ -44,15 +64,35 @@ exports[`validation schemas rehypePluginsSchema: for value=false 1`] = `"\\"valu
|
|||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=null 1`] = `"\\"value\\" must be an array"`;
|
||||
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[[]] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[[]] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[[null,null]] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[[null,null]] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[3] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[3] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[false] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[false] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[null] 1`] = `"\\"[0]\\" does not match any of the allowed types"`;
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[null] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas remarkPluginsSchema: for value=3 1`] = `"\\"value\\" must be an array"`;
|
||||
|
||||
|
|
|
@ -23,6 +23,11 @@ const MarkdownPluginsSchema = Joi.array()
|
|||
Joi.function(),
|
||||
Joi.object(),
|
||||
)
|
||||
.messages({
|
||||
'array.includes': `{#label} does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require("rehype-katex"), \\{ strict: false \\}]\`, or
|
||||
- A simple module, like \`require("remark-math")\``,
|
||||
})
|
||||
.default([]);
|
||||
|
||||
export const RemarkPluginsSchema = MarkdownPluginsSchema;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue