Repository navigation
fix(v2): fix too strict markdown frontmatter validation - #4654
Merged
Merged
Conversation
|
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-4654--docusaurus-2.netlify.app/ |
slorber
reviewed
Apr 21, 2021
slorber
left a comment
Collaborator
There was a problem hiding this comment.
Thanks @johnnyreilly , I see the problem
I'd like to do a small bugfix release soon, and have a few issues reported regarding this frontmatter validation.
As this is likely to create conflicts (like with #4655), I'll take your PR as a base and complete it so that I can release the fix asap!
I changed the assertion to actually return the value. I will try to see if I can convert to number from there
slorber
marked this pull request as ready for review
April 21, 2021 14:04
mrizwanashiq
pushed a commit
to mrizwanashiq/docusaurus
that referenced
this pull request
Jun 25, 2026
* start work * use orta.vscode-jest * node 14 * add some better infra to validate markdown frontmatter * better docs frontmatter validation * fix Yaml / Joi validation issues * fix Yaml / Joi validation issues Co-authored-by: slorber <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
PR completed by @slorber:
Original description:
To either get a meaningful error message when invalid tags are supplied, or allow them to be parsed successfully (numbers are not) - this relates to #4642
Hey @slorber,
I've started work on this and have some questions. Whilst I can get meaningful error messages using the mechanism you suggest (see changes in
blogFrontMatter.ts) the suggested:does not seem to support parsing numbers to strings automatically as suggested. Also, even if it did, it won't actually change the type of the tags in the
frontMatterobject. It's just an assertion - no mutation takes place. We could put something in themarkdownParserhere:https://github.com/facebook/docusaurus/blob/master/packages/docusaurus-utils/src/markdownParser.ts#L68-L79
that migrates numbers to strings.... Or alternatively, maybe it just throwing a meaningful error message is fine. I think the meaningful error message is the most significant thing from my perspective.
What do you think?
Have you read the [Contributing Guidelines on pull requests]
Yes
Test Plan
Automated tests!
Related PRs
N/A