Skip to content

fix: add docs tag validation to solve #5478 - #5479

Merged
slorber merged 6 commits into
meta:mainfrom
swyxio:patch-1
Sep 3, 2021
Merged

slorber merged 6 commits into
meta:mainfrom
swyxio:patch-1

Conversation

@swyxio

@swyxio swyxio commented Sep 3, 2021 •

Copy link
Copy Markdown
Contributor

fix: add docs tag validation to solve #5478

Motivation

nicer developer experience when people put in malformed tags, as suggested by @Josh-Cena #5478 (comment)

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

i confess i did not test this one locally. hoping its a simple one.

fix: add docs tag validation to solve meta#5478
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Sep 3, 2021
Comment on lines +30 to +33
tags: [Joi.string(), Joi.array().items(Joi.object({
label: Joi.string,
permalink: Joi.string
}))]

@Josh-Cena Josh-Cena Sep 3, 2021 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tags: [Joi.string(), Joi.array().items(Joi.object({
label: Joi.string,
permalink: Joi.string
}))]
tags: Joi.array().items(Joi.alternatives().try(
Joi.string(),
Joi.object({
label: Joi.string().required(),
permalink: Joi.string().required(),
}),
)),

Joi is really a pain, yeah

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@Josh-Cena

Copy link
Copy Markdown
Collaborator

Also, maybe we can elaborate in the documentation? After some pondering I think it's worth documenting both possibilities to avoid confusion.

@swyxio

swyxio commented Sep 3, 2021 •

Copy link
Copy Markdown
Contributor Author

added!

@netlify

netlify Bot commented Sep 3, 2021

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Sep 3, 2021 •

Copy link
Copy Markdown

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 76
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5479--docusaurus-2.netlify.app/

@netlify

netlify Bot commented Sep 3, 2021 •

Copy link
Copy Markdown

@slorber

slorber commented Sep 3, 2021

Copy link
Copy Markdown
Collaborator

Thanks,

I'll edit it a bit before merge because Joi default messages are so bad in this case :)

@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Sep 3, 2021
@slorber slorber linked an issue Sep 3, 2021 that may be closed by this pull request
@slorber
slorber merged commit 194f429 into meta:main Sep 3, 2021
@swyxio
swyxio deleted the patch-1 branch September 22, 2021 17:40
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
* fix: add docs tag validation to solve meta#5478

fix: add docs tag validation to solve meta#5478

* Update docFrontMatter.ts

* Update docs-create-doc.mdx

* improve tag validation error messages + tests

* improve tags doc

* fix test

Co-authored-by: slorber <[email protected]>
sparanoid pushed a commit to sparanoid/docusaurus that referenced this pull request Oct 12, 2026
* fix: add docs tag validation to solve meta#5478

fix: add docs tag validation to solve meta#5478

* Update docFrontMatter.ts

* Update docs-create-doc.mdx

* improve tag validation error messages + tests

* improve tags doc

* fix test

Co-authored-by: slorber <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

beta.5 docs tags feature - better validation for malformed tags

4 participants