Json schema yaml validation#1054
Open
dennispaagman wants to merge 2 commits into
Open
Conversation
d034ea4 to
c9a9e75
Compare
Contributor
|
I would like to keep the old "rake" method and add this too. |
Contributor
|
Would the README file change any with this new validation? |
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.
I mentioned using JSON Schema to validate / lint the yml files in the Bundler slack as a possible improvement to the workflows for this repo.
I've made a PoC below to see what's possible. It already flagged a few inconsistenties that I also fixed, so that show's there some possible value here.
Right now there are a couple of rules defined in various places:
This PR condenses those into two JSON schemas and adds a test to validate all files against the schemas by converting the yml into JSON-like ruby hashes. (Disclaimer: Claude Code was used, but I checked all output. And I hand wrote this PR description 😂)
JSON Schema is nice as it's more powerful in what you can define than kwalify does (like not allowing certain values). it's supported in most modern editors (you can get autocomplete on values, warnings, etc working when editing files). In a way it can also work as a single source of truth for the rules.
There are a couple of considerations that I can think of from the top of my head:
kwalify? There's quite a bit of duplication with that and theadvisory_*specs. I left them for now.I've made two separate commits, one that adds the schemas and it's test and one that fixes the issues it flagged in existing files. I've fixed them as I think makes sense, but they can definitely use a second pair of eyes.
Curious to hear what you think, I just wanted to at least put some effort in to show what it could look like.