Skip to content

Commit

Permalink
DefaultNavbarItemSchema href/to validation is too strict and force dr…
Browse files Browse the repository at this point in the history
…opdown parent to have an associated link (not retrocompatible)
  • Loading branch information
slorber committed Jul 23, 2020
1 parent 336c3e5 commit 3a927a1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/docusaurus-theme-classic/src/themeConfigSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ const Joi = require('@hapi/joi');

const NavbarItemPosition = Joi.string().equal('left', 'right').default('left');

// TODO we should probably create a custom navbar item type "dropdown"
// having this recursive structure is bad because we only support 2 levels
// + parent/child don't have exactly the same props
const DefaultNavbarItemSchema = Joi.object({
items: Joi.array().optional().items(Joi.link('...')),
to: Joi.string(),
Expand All @@ -19,7 +22,10 @@ const DefaultNavbarItemSchema = Joi.object({
activeBaseRegex: Joi.string(),
className: Joi.string(),
'aria-label': Joi.string(),
}).xor('href', 'to');
});
// TODO the dropdown parent item can have no href/to
// should check should not apply to dropdown parent item
// .xor('href', 'to');

const DocsVersionNavbarItemSchema = Joi.object({
type: Joi.string().equal('docsVersion').required(),
Expand Down

0 comments on commit 3a927a1

Please sign in to comment.