[PATCH 07/10] dt-bindings: mtd: Ensure partition node properties are documented
Rob Herring
robh at kernel.org
Fri Jan 9 16:34:17 PST 2026
On Fri, Jan 9, 2026 at 3:02 AM Miquel Raynal <miquel.raynal at bootlin.com> wrote:
>
> Hello Rob,
>
> On 08/01/2026 at 11:53:16 -06, "Rob Herring (Arm)" <robh at kernel.org> wrote:
>
> > Partition nodes without a compatible have no restrictions on additional
> > properties. Fix this by ensuring 'unevaluatedProperties' is set when
> > there's no compatible property. If there is a compatible property, then
> > there should be a specific schema for it which will enforce
> > 'unevaluatedProperties'.
> >
> > Signed-off-by: Rob Herring (Arm) <robh at kernel.org>
> > ---
>
> Overall thank you very much for this series, I've been sruggling while
> defining these and your approach seems very relevant. I am fine with all
> the patches in this series, but will wait a bit for others to make a bit
> of feedback.
>
> [...]
>
> > +$defs:
> > + partition-node:
> > + type: object
> > + if:
> > + not:
> > + required: [ compatible ]
> > + then:
> > + $ref: '#'
> > + unevaluatedProperties: false
> > + else:
> > + $ref: '#'
>
> This, however, is total blackmagic to me. Would you mind explaining what
>
> $ref: '#'
>
> indicates? Is this a placeholder indicating "a reference must be given?
It's what's known as JSON pointers. The '#' is a reference to the top
level of this schema.
> Also I do not understand the final else case, what is it covering?
It's really just there so a $ref to
partition.yaml#/$defs/partition-node applies the schema (all of
partition.yaml) whether there's a compatible property or not.
This all just works around that a schema like this doesn't work:
$ref: foo.yaml
if:
...
then:
unevaluatedProperties: false
The evaluation of unevaluatedProperties doesn't "see" the $ref being
in the parent. So we can't factor out the $ref.
Hope that makes sense.
Rob
More information about the linux-mtd
mailing list