discover-rewards-notifier
discover-rewards-notifier copied to clipboard
Data schema validation in CircleCI builds
Due to the size of the json data files (for both discover deals and cashback rewards), it's hard to detect when the files are changed manually. For example, someone may accidentally delete a character in the file, making the file an invalid json. Or a malicious developer could add a link to their own website in a random deal, and then send a pull request with the modified data (claiming they updated the data with the latest discover data).
Our CircleCI build phase should parse the json data files and perform schema validation. If anything unexpected occurs, it should fail the build with an informative error message.
Example schema validations:
- Ensure file is a valid JSON
- Ensure file does not contain empty values
- Ensure links are all referencing Discover-owned domains
- Ensure each json object contains the expected keys