TripSit / drugs

https://tripsit.me/
14 stars 6 forks source link

Schema validation #137

Closed LunaUrsa closed 2 months ago

LunaUrsa commented 2 months ago

This adds validations to the actual JSON structure on each pull request, ensuring that we always have a consistent data structure that matches the given schema.

@utaninja @zelixir25 With the new system I've set up, you are a "code owner" for the drugs.json and combos.json files. If any pull requests modify either of those files, one of you will need to approve them before we can merge. This PR does have a small change to drugs.json that I found thanks to this new validation process, and I can bypass the approvals, but let's get into the habit of doing things the right way.

Both of you can ignore changes outside of those files unless you want to learn the FUN and FASCINATING world of JSON file management!!!!

codeowners - Defines who will need to approve the pull request when each of those files are changed. We can add more people eventually. validate.yml - A github action that will run on every pull request. It basically runs the combosToDrugs.ts script and as long as no changes need to be made (alphabetization, schema validations, updating drugs.json) it will allow the pull request. This helps a ton because otherwise i would need to download the pull request and run the script myself. settings.json - Added your usernames to the spell check definitions package.json and package-lock.json - Defines the modules we use to run the scripts, used in every nodejs project combo_definitions-schema.json, combos-schema.json and drugs-schema.json - These files determine the structure of the corresponding JSON files. They define which properties are valid so that it's very hard to make mistakes when modifying the json

Let me know if there are any questions!