mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-06 21:03:47 +02:00
docs(v2): update the link of Joi (#3644)
This commit is contained in:
parent
c82800e0db
commit
4f64da8eda
1 changed files with 6 additions and 6 deletions
|
@ -21,15 +21,15 @@ Return validated and normalized options for the plugin. This method is called be
|
||||||
|
|
||||||
### `validate`
|
### `validate`
|
||||||
|
|
||||||
`validateOptions` is called with `validate` function which takes a **[Joi](https://www.npmjs.com/package/@hapi/joi)** schema and options as argument, returns validated and normalized options. `validate` will automatically handle error and validation config.
|
`validateOptions` is called with `validate` function which takes a **[Joi](https://www.npmjs.com/package/joi)** schema and options as argument, returns validated and normalized options. `validate` will automatically handle error and validation config.
|
||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
|
|
||||||
[Joi](https://www.npmjs.com/package/@hapi/joi) is recommended for validation and normalization of options.
|
[Joi](https://www.npmjs.com/package/joi) is recommended for validation and normalization of options.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
If you don't use **[Joi](https://www.npmjs.com/package/@hapi/joi)** for validation you can throw an Error in case of invalid options and return options in case of success.
|
If you don't use **[Joi](https://www.npmjs.com/package/joi)** for validation you can throw an Error in case of invalid options and return options in case of success.
|
||||||
|
|
||||||
```js {8-11} title="my-plugin/src/index.js"
|
```js {8-11} title="my-plugin/src/index.js"
|
||||||
module.exports = function (context, options) {
|
module.exports = function (context, options) {
|
||||||
|
@ -71,15 +71,15 @@ Return validated and normalized configuration for the theme.
|
||||||
|
|
||||||
### `validate`
|
### `validate`
|
||||||
|
|
||||||
`validateThemeConfig` is called with `validate` function which takes a **[Joi](https://www.npmjs.com/package/@hapi/joi)** schema and `themeConfig` as argument, returns validated and normalized options. `validate` will automatically handle error and validation config.
|
`validateThemeConfig` is called with `validate` function which takes a **[Joi](https://www.npmjs.com/package/joi)** schema and `themeConfig` as argument, returns validated and normalized options. `validate` will automatically handle error and validation config.
|
||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
|
|
||||||
[Joi](https://www.npmjs.com/package/@hapi/joi) is recommended for validation and normalization of theme config.
|
[Joi](https://www.npmjs.com/package/joi) is recommended for validation and normalization of theme config.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
If you don't use **[Joi](https://www.npmjs.com/package/@hapi/joi)** for validation you can throw an Error in case of invalid options.
|
If you don't use **[Joi](https://www.npmjs.com/package/joi)** for validation you can throw an Error in case of invalid options.
|
||||||
|
|
||||||
```js {8-11} title="my-theme/src/index.js"
|
```js {8-11} title="my-theme/src/index.js"
|
||||||
module.exports = function (context, options) {
|
module.exports = function (context, options) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue