* notes/cli-end-to-end-demo.org (Database Aquisition):
Starting description for the end-to-end demonstration workflow.
Very simplified version of notes/cli-end-to-end.org
* docker-compose-demo.yml (services):
Make the pre-populated ql database storage an explicit container
to get persistent data and straightforward mount semantics.
* docker-compose-demo-build.yml (services):
Add a docker-compose configuration for *building* the demo environment.
* demo/containers/dbsdata/Dockerfile:
Add dbsdata Docker image to hold initialized minio database file tree
* client/containers/vscode/README.org
Update vscode container to use custom plugin for later mrva redirection
Only one is really needed for large storage for the dbstore container. The demo containers can contain their own data -- it's small
and the containers are made for demonstration anyway.
The problem was missing fields in the SARIF output. After the debugging
below, the cause were conversions from JSON to Go to JSON; the Go ->
JSON conversion only output the fields defined in the Go struct.
Because SARIF has so many optional fields, no attempt is made to enforce
a statically-defined structure. Instead, the JSON -> Go conversion is
now to a fully dynamic structure; unused fields are simply passed through
Debugging:
Comparing two SARIF files shows
{
"$schema" : "https://json.schemastore.org/sarif-2.1.0.json",
"version" : "2.1.0",
"runs" : [ {...
} ]
}
and
{
"runs": [...
]
}
so there are missing fields.
The Problem
1. Problem origin
// Modify the sarif: start by extracting
var sarif Sarif
if err := json.Unmarshal(sarifData, &sarif); err != nil {
return nil, fmt.Errorf("failed to unmarshal SARIF: %v", err)
}
...
// now inject version control info
...
// and write it back
sarifBytes, err := json.Marshal(sarif)
if err != nil {
return nil, fmt.Errorf("failed to marshal SARIF: %v", err)
}
2. But the struct only has one of the needed fields
type Sarif struct {
Runs []SarifRun `json:"runs"`
}
3. From the docs:
// To unmarshal JSON into a struct, Unmarshal matches incoming object
// keys to the keys used by [Marshal] (either the struct field name or its tag),
// preferring an exact match but also accepting a case-insensitive match. By
// default, object keys which don't have a corresponding struct field are
// ignored (see [Decoder.DisallowUnknownFields] for an alternative).