From: Rob Herring <robh@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, sdf@google.com, jacob.e.keller@intel.com,
vadfed@fb.com, johannes@sipsolutions.net, jiri@resnulli.us,
dsahern@kernel.org, stephen@networkplumber.org, fw@strlen.de,
linux-doc@vger.kernel.org
Subject: Re: [RFC net-next 2/4] ynl: add the schema for the schemas
Date: Wed, 28 Sep 2022 07:32:16 -0500 [thread overview]
Message-ID: <CAL_JsqJTg58HGJG6QbdNmHuUVK8EoEtzbQkMQOiprw01ryv83g@mail.gmail.com> (raw)
In-Reply-To: <20220927145622.4e3339a4@kernel.org>
On Tue, Sep 27, 2022 at 4:56 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Mon, 26 Sep 2022 11:10:56 -0500 Rob Herring wrote:
> > On Wed, Aug 10, 2022 at 07:23:02PM -0700, Jakub Kicinski wrote:
> > > A schema in jsonschema format which should be familiar
> > > to dt-bindings writers. It looks kinda hard to read, TBH,
> > > I'm not sure how to make it better.
[...]
> > > + description: Description of the family
> > > + type: string
> > > + version:
> > > + description: Version of the family as defined by genetlink.
> > > + type: integer
> >
> > Do you have the need to define the int size? We did our own keyword for
> > this, but since then I've looked at several other projects that have
> > used something like 'format: uint32'. There was some chatter about
> > trying to standardize this, but I haven't checked in a while.
>
> It's 8 bits in theory (struct genlmsghdr::version), in practice it's
> never used, and pretty much ignored. The jsonschema I have on Fedora
> does not know about uint8.
It wouldn't. It's some users of jsonschema that have added their own
thing. With python-jsonschema, you can add your own FormatChecker
class to handle custom 'format' entries.
> > > + attr-cnt-suffix:
> > > + description: Suffix for last member of attribute enum, default is "MAX".
> > > + type: string
> > > + headers:
> > > + description: C headers defining the protocol
> > > + type: object
> > > + additionalProperties: False
> > > + properties:
> > > + uapi:
> > > + description: Path under include/uapi where protocol definition is placed
> > > + type: string
> > > + kernel:
> > > + description: Additional headers on which the protocol definition depends (kernel side)
> > > + anyOf: &str-or-arrstr
> > > + -
> > > + type: array
> > > + items:
> > > + type: string
> > > + -
> > > + type: string
> > > + user:
> > > + description: Additional headers on which the protocol definition depends (user side)
> > > + anyOf: *str-or-arrstr
> >
> > For DT, we stick to a JSON compatible subset of YAML, so no anchors. The
> > jsonschema way to do this is using '$defs' (or 'definitions' before the
> > spec standardized it) and '$ref'.
>
> I need to read up on this. Is it possible to extend a type?
> We really need a way to define a narrow set of properties for "going
> forward" while the old families have extra quirks. I couldn't find any
> jsonschema docs on how the inherit and extend.
You can add constraints, but you can't override what you inherit.
You do that with a $ref (and unevaluatedProperties if adding
properties) to the base schema and then add more schema constraints.
For example, we define something as an array with a $ref and then add
the bounds to it. That can also be done by 2 schemas applied
independently. However, if it's constraining properties present in an
object, then that can't be independent (that's where
unevaluatedProperties comes into play).
Rob
next prev parent reply other threads:[~2022-09-28 12:32 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-11 2:23 [RFC net-next 0/4] ynl: YAML netlink protocol descriptions Jakub Kicinski
2022-08-11 2:23 ` [RFC net-next 1/4] ynl: add intro docs for the concept Jakub Kicinski
2022-08-11 20:17 ` Edward Cree
2022-08-12 22:23 ` Jakub Kicinski
2022-08-15 20:09 ` Johannes Berg
2022-08-16 0:32 ` Jakub Kicinski
2022-08-16 7:07 ` Johannes Berg
2022-08-11 2:23 ` [RFC net-next 2/4] ynl: add the schema for the schemas Jakub Kicinski
2022-08-15 20:03 ` Johannes Berg
2022-08-15 20:09 ` Johannes Berg
2022-08-16 0:47 ` Jakub Kicinski
2022-08-16 7:21 ` Johannes Berg
2022-08-16 15:53 ` Jakub Kicinski
2022-08-16 19:30 ` Johannes Berg
2022-09-26 16:10 ` Rob Herring
2022-09-27 21:56 ` Jakub Kicinski
2022-09-28 12:32 ` Rob Herring [this message]
2022-08-11 2:23 ` [RFC net-next 3/4] ynl: add a sample python library Jakub Kicinski
2022-08-11 5:48 ` Benjamin Poirier
2022-08-11 15:50 ` Jakub Kicinski
2022-08-11 20:09 ` Stephen Hemminger
2022-08-12 22:53 ` Jakub Kicinski
2022-08-15 20:00 ` Johannes Berg
2022-08-12 1:04 ` Stephen Hemminger
2022-08-12 15:42 ` Edward Cree
2022-08-12 23:07 ` Jakub Kicinski
2022-08-18 21:26 ` Keller, Jacob E
2022-08-11 2:23 ` [RFC net-next 4/4] ynl: add a sample user for ethtool Jakub Kicinski
2022-08-11 16:18 ` sdf
2022-08-11 19:35 ` Jakub Kicinski
2022-08-11 22:55 ` Stanislav Fomichev
2022-08-11 23:31 ` Jakub Kicinski
2022-08-12 16:26 ` Stanislav Fomichev
2022-08-12 22:48 ` Jakub Kicinski
2022-08-14 12:27 ` Ido Schimmel
2022-08-11 4:15 ` [RFC net-next 0/4] ynl: YAML netlink protocol descriptions Stephen Hemminger
2022-08-11 4:47 ` Jakub Kicinski
2022-08-11 15:01 ` Stephen Hemminger
2022-08-11 15:34 ` Jakub Kicinski
2022-08-11 16:28 ` sdf
2022-08-11 19:42 ` Jakub Kicinski
2022-08-12 17:00 ` Florian Fainelli
2022-08-12 22:26 ` Jakub Kicinski
2022-08-19 19:56 ` Jakub Kicinski
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAL_JsqJTg58HGJG6QbdNmHuUVK8EoEtzbQkMQOiprw01ryv83g@mail.gmail.com \
--to=robh@kernel.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=jacob.e.keller@intel.com \
--cc=jiri@resnulli.us \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@google.com \
--cc=stephen@networkplumber.org \
--cc=vadfed@fb.com \
/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.
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 NNTP newsgroup(s).