...
1#!/usr/bin/env bash
2
3set -e
4
5# This script updates the log list JSON Schema and the Go structs generated
6# from that schema.
7
8# It is not intended to be run on a regular basis; we do not expect the JSON
9# Schema to change. It is retained here for historical purposes, so that if/when
10# the schema does change, or the ecosystem moves to a v4 version of the schema,
11# regenerating these files will be quick and easy.
12
13# This script expects github.com/atombender/go-jsonschema to be installed:
14if ! command -v gojsonschema
15then
16 echo "Install gojsonschema, then re-run this script:"
17 echo "go install github.com/atombender/go-jsonschema/cmd/gojsonschema@latest"
18fi
19
20this_dir=$(dirname $(readlink -f "${0}"))
21
22curl https://www.gstatic.com/ct/log_list/v3/log_list_schema.json >| "${this_dir}"/log_list_schema.json
23
24gojsonschema -p schema "${this_dir}"/log_list_schema.json >| "${this_dir}"/schema.go
View as plain text