fix(v2): make config validation less strict (#3120)

* fix(v2): make navbar title validation less strict

* fix(v2): fix validation for rehype plugin

* fix(v2): allow empty string for routeBasePath

* fix(v2): fix validation for stylesheets and scripts field

* fix(v2): rerun CI

* fix(v2): relax check for stylesheet href
This commit is contained in:
Teik Jun 2020-07-27 19:58:24 +08:00 committed by GitHub
parent 41d5ac63fd
commit 2159c4fcfb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 16 deletions

View file

@ -29,7 +29,7 @@ export const DEFAULT_OPTIONS: PluginOptions = {
export const PluginOptionSchema = Joi.object({
path: Joi.string().default(DEFAULT_OPTIONS.path),
editUrl: Joi.string().uri(),
routeBasePath: Joi.string().default(DEFAULT_OPTIONS.routeBasePath),
routeBasePath: Joi.string().allow('').default(DEFAULT_OPTIONS.routeBasePath),
homePageId: Joi.string().default(DEFAULT_OPTIONS.homePageId),
include: Joi.array().items(Joi.string()).default(DEFAULT_OPTIONS.include),
sidebarPath: Joi.string().default(DEFAULT_OPTIONS.sidebarPath),
@ -37,12 +37,19 @@ export const PluginOptionSchema = Joi.object({
docItemComponent: Joi.string().default(DEFAULT_OPTIONS.docItemComponent),
remarkPlugins: Joi.array()
.items(
Joi.array().items(Joi.function(), Joi.object()).length(2),
Joi.array()
.items(Joi.function().required(), Joi.object().required())
.length(2),
Joi.function(),
)
.default(DEFAULT_OPTIONS.remarkPlugins),
rehypePlugins: Joi.array()
.items(Joi.string())
.items(
Joi.array()
.items(Joi.function().required(), Joi.object().required())
.length(2),
Joi.function(),
)
.default(DEFAULT_OPTIONS.rehypePlugins),
showLastUpdateTime: Joi.bool().default(DEFAULT_OPTIONS.showLastUpdateTime),
showLastUpdateAuthor: Joi.bool().default(