Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add schema validation to yaml for documentation #2518

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

castastrophe
Copy link
Collaborator

@castastrophe castastrophe commented Feb 13, 2024

Description

This adds a schema validation task to each component which will check all metadata files for valid formatting and that it aligns with the defined rules in ./schemas/documentation.schema.json.

This validation can be run ad-hoc and runs as part of the lint-staged task to prevent new invalid schema from being committed (can still be overwritten with --no-verify).

How and where has this been tested?

Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.

Validation steps

Add an invalid entry to the components/accordion/metadata/*.yml (i.e., foo: bar):

  • yarn validator accordion: should report the error to the console
  • yarn validate: should report success for other components and report the failure for accordion's schema
  • Try to commit the error to the branch. Expect the commit to fail with the following:
Screenshot 2024-02-13 at 1 45 37 PM

To-do list

  • I have read the contribution guidelines.
  • If my change impacts documentation, I have updated the documentation accordingly.
  • ✨ This pull request is ready to merge. ✨

Copy link
Contributor

github-actions bot commented Feb 13, 2024

File metrics

Summary

Total size: 3.94 MB*

🎉 No changes detected in any packages

* Size determined by adding together the size of the main file for all packages in the library.
* Results are not gzipped or minified.
* An ASCII character in UTF-8 is 8 bits or 1 byte.

Copy link
Contributor

github-actions bot commented Feb 13, 2024

🚀 Deployed on https://pr-2518--spectrum-css.netlify.app

@castastrophe castastrophe force-pushed the chore-add-doc-schema branch 5 times, most recently from 649ac76 to bb09b22 Compare February 13, 2024 18:45
@castastrophe castastrophe added skip_vrt Add to a PR to skip running VRT (but still pass the action) ready-for-review labels Feb 13, 2024
@castastrophe castastrophe requested a review from pfulton February 13, 2024 18:50
@castastrophe castastrophe marked this pull request as ready for review February 13, 2024 18:50
Copy link
Collaborator

@mdt2 mdt2 left a comment

Choose a reason for hiding this comment

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

Nice addition! Just left a context question, but this should be good to go, it's working well on my end.

components/dialog/metadata/dialog.yml Show resolved Hide resolved
@castastrophe castastrophe merged commit 057717c into main Feb 14, 2024
10 checks passed
@castastrophe castastrophe deleted the chore-add-doc-schema branch February 14, 2024 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-review skip_vrt Add to a PR to skip running VRT (but still pass the action)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants