git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH v2 1/3] trace2: Add a JSON schema for trace2 events

From
Jakub Narebski <jnareb@gmail.com>
Date
Jul 10, 2019, 18:32 UTC
Message-ID
<86wogp68q0.fsf@gmail.com>
In-Reply-To
<a949db776c77e5c97c78055f1bb0f2101096f861.1562712943.git.steadmon@google.com>
Josh Steadmon <steadmon@google.com> writes:
Show 5 quoted lines
> Define a JSON schema[1] that can be used to validate trace2 event
> objects. This can be used to add regression tests to verify that the
> event output format does not change unexpectedly.
>
> Two versions of the schema are provided:

Actually, four versions of the schema are provided, as you have written in the t/trace_schema_validator/README file.

Show 56 quoted lines
> * event_schema.json is more permissive. It verifies that all expected
>   fields are present in each trace event, but it allows traces to have
>   unexpected additional fields. This allows the schema to be specified
>   more concisely by factoring out the common fields into a reusable
>   sub-schema.
> * strict_schema.json is more restrictive. It verifies that all expected
>   fields are present and no unexpected fields are present in each trace
>   event. Due to this additional restriction, the common fields cannot be
>   factored out into a re-usable subschema (at least as-of draft-07) [2],
>   and must be repeated for each event definition.
>
> [1]: https://json-schema.org/
> [2]: https://json-schema.org/understanding-json-schema/reference/combining.html#allof
>
> Signed-off-by: Josh Steadmon <steadmon@google.com>
> ---
>  t/trace_schema_validator/README               |  23 +
>  t/trace_schema_validator/event_schema.json    | 398 ++++++++++++++
>  t/trace_schema_validator/list_schema.json     | 401 ++++++++++++++
>  .../strict_list_schema.json                   | 514 ++++++++++++++++++
>  t/trace_schema_validator/strict_schema.json   | 511 +++++++++++++++++
>  5 files changed, 1847 insertions(+)
>  create mode 100644 t/trace_schema_validator/README
>  create mode 100644 t/trace_schema_validator/event_schema.json
>  create mode 100644 t/trace_schema_validator/list_schema.json
>  create mode 100644 t/trace_schema_validator/strict_list_schema.json
>  create mode 100644 t/trace_schema_validator/strict_schema.json
>
> diff --git a/t/trace_schema_validator/README b/t/trace_schema_validator/README
> new file mode 100644
> index 0000000000..45f0e6f0c4
> --- /dev/null
> +++ b/t/trace_schema_validator/README
> @@ -0,0 +1,23 @@
> +These JSON schemas[1] can be used to validate trace2 event objects. They
> +can be used to add regression tests to verify that the event output
> +format does not change unexpectedly.
> +
> +Four versions of the schema are provided:
> +* event_schema.json is more permissive. It verifies that all expected
> +  fields are present in a trace event, but it allows traces to have
> +  unexpected additional fields. This allows the schema to be specified
> +  more concisely by factoring out the common fields into a reusable
> +  sub-schema.
> +* strict_schema.json is more restrictive. It verifies that all expected
> +  fields are present and no unexpected fields are present in the trace
> +  event. Due to this additional restriction, the common fields cannot be
> +  factored out into a re-usable subschema (at least as-of draft-07) [2],
> +  and must be repeated for each event definition.
> +* list_schema.json is like event_schema.json above, but validates a JSON
> +  array of trace events, rather than a single event.
> +* strict_list_schema.json is like strict_schema.json above, but
> +  validates a JSON array of trace events, rather than a single event.
> +
> +[1]: https://json-schema.org/
> +[2]: https://json-schema.org/understanding-json-schema/reference/combining.html#allof
[...]
-- 
Jakub Narębski
Previous: Josh SteadmonNext: Josh Steadmon
Message 18 of 47 in “Add a JSON Schema for trace2 events”
  1. 0/3 Add a JSON Schema for trace2 eventsJosh Steadmon, Jun 11, 2019
  2. 1/3 trace2: correct trace2 field name documentationJosh Steadmon, Jun 11, 2019
  3. Junio C HamanoJun 12, 2019
  4. Josh SteadmonJun 12, 2019
  5. Jeff HostetlerJun 14, 2019
  6. 3/3 trace2: add a schema validator for trace2 eventsJosh Steadmon, Jun 11, 2019
  7. Ævar Arnfjörð BjarmasonJun 12, 2019
  8. Josh SteadmonJun 12, 2019
  9. Jeff KingJun 12, 2019
  10. Josh SteadmonJun 20, 2019
  11. Jakub NarebskiJun 21, 2019
  12. Jeff HostetlerJun 27, 2019
  13. 2/3 trace2: Add a JSON schema for trace2 eventsJosh Steadmon, Jun 11, 2019
  14. Jeff HostetlerJun 14, 2019
  15. Josh SteadmonJun 20, 2019
  16. 0/3 Add a JSON Schema for trace2 eventsJosh Steadmon, Jul 9, 2019
  17. 1/3 trace2: Add a JSON schema for trace2 eventsJosh Steadmon, Jul 9, 2019
  18. Jakub NarebskiJul 10, 2019
  19. Josh SteadmonJul 24, 2019
  20. 2/3 trace2: add a schema validator for trace2 eventsJosh Steadmon, Jul 9, 2019
  21. Jakub NarebskiJul 11, 2019
  22. Josh SteadmonJul 24, 2019
  23. 3/3 ci: run trace2 schema validation in the CI suiteJosh Steadmon, Jul 9, 2019
  24. 0/3 Add a JSON Schema for trace2 eventsJosh Steadmon, Jul 24, 2019
  25. 1/3 trace2: Add a JSON schema for trace2 eventsJosh Steadmon, Jul 24, 2019
  26. Junio C HamanoJul 25, 2019
  27. 2/3 trace2: add a schema validator for trace2 eventsJosh Steadmon, Jul 24, 2019
  28. 3/3 ci: run trace2 schema validation in the CI suiteJosh Steadmon, Jul 24, 2019
  29. SZEDER GáborJul 25, 2019
  30. Junio C HamanoJul 25, 2019
  31. Josh SteadmonJul 26, 2019
  32. SZEDER GáborJul 25, 2019
  33. Johannes SchindelinJul 26, 2019
  34. SZEDER GáborJul 26, 2019
  35. Johannes SchindelinJul 31, 2019
  36. Josh SteadmonJul 26, 2019
  37. Josh SteadmonAug 1, 2019
  38. Jonathan NiederAug 2, 2019
  39. Johannes SchindelinAug 2, 2019
  40. Jonathan NiederAug 2, 2019
  41. SZEDER GáborAug 2, 2019
  42. Jonathan NiederAug 2, 2019
  43. Johannes SchindelinAug 3, 2019
  44. SZEDER GáborAug 2, 2019
  45. Jonathan NiederAug 2, 2019
  46. SZEDER GáborAug 3, 2019
  47. SZEDER GáborAug 3, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.