Repository navigation
fix: add docs tag validation to solve #5478 - #5479
Conversation
fix: add docs tag validation to solve meta#5478
| tags: [Joi.string(), Joi.array().items(Joi.object({ | ||
| label: Joi.string, | ||
| permalink: Joi.string | ||
| }))] |
There was a problem hiding this comment.
| 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
There was a problem hiding this comment.
Actually, there's a FrontMatterTagsSchema from utils-validation. See here:
|
Also, maybe we can elaborate in the documentation? After some pondering I think it's worth documenting both possibilities to avoid confusion. |
|
added! |
|
✔️ [V2] 🔨 Explore the source changes: 07cc898 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/6131db85383ece000808ec17 😎 Browse the preview: https://deploy-preview-5479--docusaurus-2.netlify.app |
|
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-5479--docusaurus-2.netlify.app/ |
|
✔️ [V2] 🔨 Explore the source changes: 8166cac 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/6132038502ac780007994f1e 😎 Browse the preview: https://deploy-preview-5479--docusaurus-2.netlify.app |
|
Thanks, I'll edit it a bit before merge because Joi default messages are so bad in this case :) |
* 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]>
* 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]>
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.