Skip to content

Commit 24d3f59

Browse files
committed
Remove 'allOf' when used with '$ref'
In json-schema 2019.09 syntax, keywords in addition to an $ref are no longer ignored so an 'allOf' is no longer needed. We fix this up when preprocessing the schemas until jsonschema module has 2019.09 support. Remove all the cases in the schemas and test schemas so others don't copy the old syntax. Signed-off-by: Rob Herring <[email protected]>
1 parent 6015fae commit 24d3f59

File tree

6 files changed

+64
-95
lines changed

6 files changed

+64
-95
lines changed

schemas/cache-controller.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ properties:
1515
pattern: "^(cache-controller|cpu)(@[0-9a-f,]+)*$"
1616

1717
cache-level:
18-
allOf:
19-
- $ref: "/schemas/types.yaml#/definitions/uint32"
20-
- maximum: 32
18+
$ref: "/schemas/types.yaml#/definitions/uint32"
19+
maximum: 32
2120

2221
cache-unified:
2322
$ref: "/schemas/types.yaml#/definitions/flag"

schemas/chosen.yaml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,16 @@ properties:
7575
a different secondary CPU release mechanism).
7676

7777
linux,elfcorehdr:
78-
allOf:
79-
- $ref: types.yaml#/definitions/uint64-array
80-
- maxItems: 2
78+
$ref: types.yaml#/definitions/uint64-array
79+
maxItems: 2
8180
description:
8281
This property (currently used only on arm64) holds the memory range,
8382
the address and the size, of the elf core header which mainly describes
8483
the panicked kernel\'s memory layout as PT_LOAD segments of elf format.
8584

8685
linux,usable-memory-range:
87-
allOf:
88-
- $ref: types.yaml#/definitions/uint64-array
89-
- maxItems: 2
86+
$ref: types.yaml#/definitions/uint64-array
87+
maxItems: 2
9088
description: |
9189
This property (arm64 only) holds a base address and size, describing a
9290
limited region in which memory may be considered available for use by
@@ -126,18 +124,16 @@ properties:
126124
linux,initrd-end is exclusive.
127125

128126
linux,pci-probe-only:
129-
allOf:
130-
- $ref: types.yaml#/definitions/uint32
127+
$ref: types.yaml#/definitions/uint32
131128
enum: [ 0, 1 ]
132129
description:
133130
Optional property which takes a single-cell argument. If '0', then Linux
134131
will assign devices in its usual manner, otherwise it will not try to
135132
assign devices and instead use them as they are configured already.
136133

137134
stdout-path:
138-
allOf:
139-
- $ref: types.yaml#/definitions/string
140-
- pattern: "^[a-zA-Z0-9@/,+\\-._]*(:[0-9]*[noe]?[78]?[r]?)?$"
135+
$ref: types.yaml#/definitions/string
136+
pattern: "^[a-zA-Z0-9@/,+\\-._]*(:[0-9]*[noe]?[78]?[r]?)?$"
141137
description: |
142138
Device trees may specify the device to be used for boot console output
143139
with a stdout-path property under /chosen, as described in the Devicetree

schemas/dt-core.yaml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ properties:
1818
$nodename:
1919
$ref: "types.yaml#/definitions/string"
2020
compatible:
21-
allOf:
22-
- $ref: "types.yaml#/definitions/string-array"
21+
$ref: "types.yaml#/definitions/string-array"
2322
items:
2423
pattern: "^[a-zA-Z][a-zA-Z0-9,+\\-._]+$"
2524
dma-coherent:
@@ -35,17 +34,13 @@ properties:
3534
reg:
3635
$ref: "types.yaml#/definitions/uint32-matrix"
3736
status:
38-
allOf:
39-
- $ref: "types.yaml#/definitions/string"
40-
- items:
41-
- enum: [ okay, disabled ]
37+
$ref: "types.yaml#/definitions/string"
38+
enum: [ okay, disabled ]
4239
patternProperties:
4340
"^#.*-cells$":
44-
allOf:
45-
- $ref: "types.yaml#/definitions/uint32"
46-
- items:
47-
- items:
48-
maximum: 8
41+
$ref: "types.yaml#/definitions/uint32"
42+
items:
43+
maximum: 8
4944

5045
".*-names$":
5146
$ref: "types.yaml#/definitions/non-unique-string-array"

schemas/gpio/gpio.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ properties:
1919
ngpios:
2020
$ref: "/schemas/types.yaml#/definitions/uint32"
2121
gpio-reserved-ranges:
22-
allOf:
23-
- $ref: "/schemas/types.yaml#/definitions/uint32-matrix"
24-
- items:
25-
minItems: 2
26-
maxItems: 2
22+
$ref: "/schemas/types.yaml#/definitions/uint32-matrix"
23+
items:
24+
minItems: 2
25+
maxItems: 2
2726
gpio-ranges:
2827
$ref: "/schemas/types.yaml#/definitions/phandle-array"
2928

schemas/pci/pci-bus.yaml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ properties:
7575
const: pci
7676

7777
bus-range:
78-
allOf:
79-
- $ref: /schemas/types.yaml#/definitions/uint32-array
78+
$ref: /schemas/types.yaml#/definitions/uint32-array
8079
minItems: 2
8180
maxItems: 2
8281
items:
@@ -106,12 +105,10 @@ properties:
106105
maximum: 7
107106

108107
linux,pci-domain:
109-
allOf:
110-
- $ref: /schemas/types.yaml#/definitions/uint32
108+
$ref: /schemas/types.yaml#/definitions/uint32
111109

112110
max-link-speed:
113-
allOf:
114-
- $ref: /schemas/types.yaml#/definitions/uint32
111+
$ref: /schemas/types.yaml#/definitions/uint32
115112
enum: [ 1, 2, 3, 4 ]
116113

117114
reset-gpios:
@@ -127,13 +124,11 @@ properties:
127124

128125
vendor-id:
129126
description: The PCI vendor ID
130-
allOf:
131-
- $ref: /schemas/types.yaml#/definitions/uint32
127+
$ref: /schemas/types.yaml#/definitions/uint32
132128

133129
device-id:
134130
description: The PCI device ID
135-
allOf:
136-
- $ref: /schemas/types.yaml#/definitions/uint32
131+
$ref: /schemas/types.yaml#/definitions/uint32
137132

138133
patternProperties:
139134
"^[a-zA-Z][a-zA-Z0-9,+\\-._]{0,63}@1?[0-9a-f](,[0-7])?$":

test/schemas/good-example.yaml

Lines changed: 40 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -88,110 +88,95 @@ properties:
8888
description: A vendor specific boolean property
8989

9090
vendor,int-prop:
91-
allOf:
92-
- $ref: "/schemas/types.yaml#/definitions/uint32"
93-
- enum: [ 1, 2, 3 ]
91+
$ref: "/schemas/types.yaml#/definitions/uint32"
92+
enum: [ 1, 2, 3 ]
9493
description: Vendor specific single cell integer property
9594

9695
vendor,int-array-prop:
97-
allOf:
98-
- $ref: "/schemas/types.yaml#/definitions/uint32-array"
99-
- items:
100-
minimum: 5
101-
maximum: 10
96+
$ref: "/schemas/types.yaml#/definitions/uint32-array"
97+
items:
98+
minimum: 5
99+
maximum: 10
102100
description: Vendor specific integer array property
103101

104102
vendor,int-array-prop-2:
105-
allOf:
106-
- $ref: "/schemas/types.yaml#/definitions/uint32-array"
107-
- items:
108-
- const: 5
109-
- const: 10
103+
$ref: "/schemas/types.yaml#/definitions/uint32-array"
104+
items:
105+
- const: 5
106+
- const: 10
110107
description: Vendor specific integer array property
111108

112109
vendor,int-array-size-only-prop:
113-
allOf:
114-
- $ref: "/schemas/types.yaml#/definitions/uint32-array"
110+
$ref: "/schemas/types.yaml#/definitions/uint32-array"
115111
minItems: 2
116112
maxItems: 5
117113
description: Vendor specific integer array property with only a size
118114
range. This can use either form of brackets.
119115

120116
vendor,string-prop:
121-
allOf:
122-
- $ref: "/schemas/types.yaml#/definitions/string"
123-
- enum:
124-
- foo
125-
- bar
117+
$ref: "/schemas/types.yaml#/definitions/string"
118+
enum:
119+
- foo
120+
- bar
126121
description: Vendor specific single string property
127122

128123
vendor,string-list-prop:
129-
allOf:
130-
- $ref: "/schemas/types.yaml#/definitions/string-array"
131-
- minItems: 2
132-
items:
133-
- const: foobar
134-
- const: foobaz
124+
$ref: "/schemas/types.yaml#/definitions/string-array"
125+
minItems: 2
126+
items:
127+
- const: foobar
128+
- const: foobaz
135129
description: Vendor specific string list property
136130

137131
vendor,int8-prop:
138132
$ref: /schemas/types.yaml#/definitions/uint8
139133
description: Vendor specific 8-bit integer property
140134

141135
vendor,int8-array-prop:
142-
allOf:
143-
- $ref: /schemas/types.yaml#/definitions/uint8-array
144-
- items:
145-
- minItems: 2
146-
maxItems: 3
136+
$ref: /schemas/types.yaml#/definitions/uint8-array
137+
items:
138+
- minItems: 2
139+
maxItems: 3
147140
description: A vendor specific uint8 array property with 2 or 3 entries
148141

149142
vendor,int16-prop:
150-
allOf:
151-
- $ref: /schemas/types.yaml#/definitions/uint16
152-
- enum: [ 1, 2, 3 ]
143+
$ref: /schemas/types.yaml#/definitions/uint16
144+
enum: [ 1, 2, 3 ]
153145
description: Vendor specific 16-bit integer property
154146

155147
vendor,int16-array-prop:
156-
allOf:
157-
- $ref: /schemas/types.yaml#/definitions/uint16-array
158-
- items:
159-
- const: 1
160-
- const: 2
148+
$ref: /schemas/types.yaml#/definitions/uint16-array
149+
items:
150+
- const: 1
151+
- const: 2
161152
description: Vendor specific 16-bit integer array property
162153

163154
vendor,int64-prop:
164-
allOf:
165-
- $ref: /schemas/types.yaml#/definitions/uint64
166-
- items:
167-
- items:
168-
- minimum: 0x1234
155+
$ref: /schemas/types.yaml#/definitions/uint64
156+
minimum: 0x1234
169157

170158
description: Vendor specific 16-bit integer property
171159

172160
vendor,int64-array-prop:
173-
allOf:
174-
- $ref: /schemas/types.yaml#/definitions/uint64-array
161+
$ref: /schemas/types.yaml#/definitions/uint64-array
175162
description: Vendor specific 64-bit integer array property
176163

177164
vendor,phandle-prop:
178165
$ref: "/schemas/types.yaml#/definitions/phandle"
179166
description: Vendor specific single cell phandle property
180167

181168
vendor,phandle-array-prop:
182-
allOf:
183-
- $ref: "/schemas/types.yaml#/definitions/phandle-array"
184-
- minItems: 2
169+
$ref: "/schemas/types.yaml#/definitions/phandle-array"
170+
minItems: 2
185171
description: Vendor specific array of phandles property
186172

187173
vendor,phandle-with-fixed-cells:
188-
allOf:
189-
- $ref: "/schemas/types.yaml#/definitions/phandle-array"
174+
$ref: "/schemas/types.yaml#/definitions/phandle-array"
175+
items:
190176
- items:
191-
- items:
192-
- description: the phandle to something
193-
- description: the 1st cell data
194-
- description: the 2nd cell data
177+
- description: the phandle to something
178+
- description: the 1st cell data
179+
- description: the 2nd cell data
195180
description: Vendor specific array of phandles property
196181

197182

0 commit comments

Comments
 (0)