Skip to content

Commit

Permalink
docs(v2): update the link of joi
Browse files Browse the repository at this point in the history
  • Loading branch information
kenve committed Oct 27, 2020
1 parent c82800e commit ece8cd1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions website/docs/lifecycle-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ Return validated and normalized options for the plugin. This method is called be

### `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

[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"
module.exports = function (context, options) {
Expand Down Expand Up @@ -71,15 +71,15 @@ Return validated and normalized configuration for the theme.

### `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

[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"
module.exports = function (context, options) {
Expand Down

0 comments on commit ece8cd1

Please sign in to comment.