go-otm
is a golang package that implements a go schema of the Open Threat Model (OTM) Format. https://github.com/iriusrisk/OpenThreatModel
Note This was primarily constructed to allow github.com/xntrik/hcltm to export OTM JSON schema exports.
Currently this spec is generated with the github.com/atombendor/go-jsonschema cli tool. I haven't yet bothered building this in github actions, so these are the manual steps I follow to update this repo.
- Install github.com/atombender/go-jsonschema
- Clone github.com/iriusrisk/OpenThreatModel somewhere
- From the root of the go-otm repo run:
go-jsonschema -p otm -o pkg/otm/otm.go -v ../../iriusrisk/OpenThreatModel/otm_schema.json
- Check the diff
- Copy the
otm_schema.json
into pkg/otm/testdata/otm_schema.json - Make sure that the
make test
tests pass - you may need to update the pkg/otm/testdata/EXAMPLE.json file from theOpenThreatModel
repo
The main.go demonstrates the use of the package, and will print out a JSON string.