From: Josh Steadmon <steadmon@google.com>
To: Jeff Hostetler <git@jeffhostetler.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH 2/3] trace2: Add a JSON schema for trace2 events
Date: Thu, 20 Jun 2019 10:26:46 -0700 [thread overview]
Message-ID: <20190620172646.GD42943@google.com> (raw)
In-Reply-To: <c624600c-42d6-d68f-28c1-916efc6b38b6@jeffhostetler.com>
On 2019.06.14 11:59, Jeff Hostetler wrote:
>
>
> On 6/11/2019 7:31 PM, Josh Steadmon wrote:
> > 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:
> > * 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.
> >
> [...]
> > +
> > + "data-json_event": {
> > + "allOf": [
> > + { "$ref": "#/definitions/event_common_fields" },
> > + {
> > + "properties": {
> > + "event": { "const": "data-json" },
> > + "repo": { "type": "integer" },
> > + "t_abs": { "type": "number" },
> > + "t_rel": { "type": "number" },
> > + "nesting": { "type": "integer" },
> > + "category": { "type": "string" },
> > + "key": { "type": "string" },
> > + "value": true
> > + },
> > + "required": [
> > + "event", "t_abs", "t_rel", "nesting", "category", "key",
> > + "value"
> > + ]
> > + }
> > + ]
> > + }
> > + },
> [...]
>
> Here you have "value" as just a boolean rather than a sub-object.
> Is that a limitation of the schema tools? I guess this is reasonable
> since the contents of the sub-object are variable and you wouldn't be
> able to verify it anyway.
Yeah, I just listed it as "true" (which in JSON-Schema means that a value is
expected but we're not making any restrictions on what it looks like) because of
not being able to verify the contents of the sub-object. But we should actually
at least verify that it's an object versus some other type, so I'll fix that if
there's enough interest for a v2 of this series.
next prev parent reply other threads:[~2019-06-20 17:26 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-11 23:31 [RFC PATCH 0/3] Add a JSON Schema for trace2 events Josh Steadmon
2019-06-11 23:31 ` [RFC PATCH 1/3] trace2: correct trace2 field name documentation Josh Steadmon
2019-06-12 18:00 ` Junio C Hamano
2019-06-12 18:14 ` Josh Steadmon
2019-06-14 15:53 ` Jeff Hostetler
2019-06-11 23:31 ` [RFC PATCH 2/3] trace2: Add a JSON schema for trace2 events Josh Steadmon
2019-06-14 15:59 ` Jeff Hostetler
2019-06-20 17:26 ` Josh Steadmon [this message]
2019-06-11 23:31 ` [RFC PATCH 3/3] trace2: add a schema validator " Josh Steadmon
2019-06-12 13:28 ` Ævar Arnfjörð Bjarmason
2019-06-12 16:23 ` Josh Steadmon
2019-06-12 19:18 ` Jeff King
2019-06-20 18:15 ` Josh Steadmon
2019-06-21 11:53 ` Jakub Narebski
2019-06-27 13:57 ` Jeff Hostetler
2019-07-09 23:05 ` [RFC PATCH v2 0/3] Add a JSON Schema " Josh Steadmon
2019-07-09 23:05 ` [RFC PATCH v2 1/3] trace2: Add a JSON schema " Josh Steadmon
2019-07-10 18:32 ` Jakub Narebski
2019-07-24 22:37 ` Josh Steadmon
2019-07-09 23:05 ` [RFC PATCH v2 2/3] trace2: add a schema validator " Josh Steadmon
2019-07-11 13:35 ` Jakub Narebski
2019-07-24 22:47 ` Josh Steadmon
2019-07-09 23:05 ` [RFC PATCH v2 3/3] ci: run trace2 schema validation in the CI suite Josh Steadmon
2019-07-24 23:06 ` [PATCH v3 0/3] Add a JSON Schema for trace2 events Josh Steadmon
2019-07-24 23:06 ` [PATCH v3 1/3] trace2: Add a JSON schema " Josh Steadmon
2019-07-25 16:55 ` Junio C Hamano
2019-07-24 23:06 ` [PATCH v3 2/3] trace2: add a schema validator " Josh Steadmon
2019-07-24 23:06 ` [PATCH v3 3/3] ci: run trace2 schema validation in the CI suite Josh Steadmon
2019-07-25 11:18 ` [PATCH v3 0/3] Add a JSON Schema for trace2 events SZEDER Gábor
2019-07-25 16:14 ` Junio C Hamano
2019-07-26 21:16 ` Josh Steadmon
2019-07-25 23:42 ` SZEDER Gábor
2019-07-26 12:12 ` Johannes Schindelin
2019-07-26 13:53 ` SZEDER Gábor
2019-07-31 11:00 ` Johannes Schindelin
2019-07-26 22:03 ` Josh Steadmon
2019-08-01 18:08 ` Josh Steadmon
2019-08-02 1:52 ` Jonathan Nieder
2019-08-02 11:56 ` Johannes Schindelin
2019-08-02 16:59 ` Jonathan Nieder
2019-08-02 19:38 ` SZEDER Gábor
2019-08-02 23:25 ` Jonathan Nieder
2019-08-03 21:25 ` Johannes Schindelin
2019-08-02 19:16 ` SZEDER Gábor
2019-08-02 23:06 ` Jonathan Nieder
2019-08-03 7:35 ` SZEDER Gábor
2019-08-03 7:40 ` SZEDER Gábor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190620172646.GD42943@google.com \
--to=steadmon@google.com \
--cc=git@jeffhostetler.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).