Subject: Re: [PATCH v3 0/3] Add a JSON Schema for trace2 events

From: Josh Steadmon <[email-masked]>
Date: Fri, 26 Jul 2019 14:16:11 -0700

On 2019.07.25 09:14, Junio C Hamano wrote:
> SZEDER Gábor <[email-masked]> writes:
> 
> >> I would appreciate any feedback on better ways to integrate the
> >> validator into the CI suite.
> >
> > How about adding a test script dedicated to JSON schema validation,
> > which runs only as many git commands as needed to cover all trace2
> > events.
> 
> Sensible, but might be hard to arrange, as the trace2 annotations on
> codepaths are not frozen.
> 
> I wonder if these schema definitions can somehow be read in reverse
> by machine to automatically generate helper functions that would by
> definition produce schema-valid json objects, and the current
> callers of trace2_*() that logs stuff can be updated to call them?
> That way, we'll automatically and always be producing valid output,
> or am I dreaming?

In that case, how would you feel about having a protobuf writer, perhaps
using Nano-PB[1]? It would handle code generation, and we could add a
new GIT_TRACE2_PB trace target to use the generated code.

[1]: https://jpa.kapsi.fi/nanopb/