Skip to content

Commit 5c2c004

Browse files
committed
meta-schemas: cell: Allow 'default' and 'uniqueItems' for common unit arrays
Properties with common unit suffixes are type of 'cell.yaml#/array' which lists allowed property names. 'default' and 'uniqueItems' are not there, thus property like: fiti,tdly-ms: description: example maxItems: 4 items: enum: [0, 1, 2, 4] default: [0, 0, 0, 0] was failing with: properties:fiti,tdly-ms: 'anyOf' conditional failed, one must be fixed: 'items' is not one of ['maxItems', 'description', 'deprecated'] hint: Only "maxItems" is required for a single entry if there are no constraints defined for the values. 'default' is not one of ['maxItems', 'description', 'deprecated'] hint: Only "maxItems" is required for a single entry if there are no constraints defined for the values. Additional properties are not allowed ('default' was unexpected) hint: Arrays must be described with a combination of minItems/maxItems/items 'maxItems' is not one of ['description', 'deprecated', 'const', 'enum', 'minimum', 'maximum', 'multipleOf', 'default', '$ref', 'oneOf'] 'items' is not one of ['description', 'deprecated', 'const', 'enum', 'minimum', 'maximum', 'multipleOf', 'default', '$ref', 'oneOf'] [0, 0, 0, 0] is not of type 'integer' 1 was expected hint: Only "maxItems" is required for a single entry if there are no constraints defined for the values. hint: cell array properties must define how many entries and what the entries are when there is more than one entry. from schema $id: http://devicetree.org/meta-schemas/cell.yaml Add a simple test-case for that which can be used with: dt-doc-validate -u test/schemas test/schemas/property-units-example.yaml Signed-off-by: Krzysztof Kozlowski <[email protected]>
1 parent e0527d5 commit 5c2c004

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

dtschema/meta-schemas/cell.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ array:
5656
additionalItems:
5757
type: boolean
5858
const: true
59+
default: true
5960
description: true
6061
deprecated: true
62+
uniqueItems: true
6163

6264
additionalProperties: false
6365

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-License-Identifier: BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/property-units-example.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Test for property units
8+
9+
maintainers:
10+
- Rob Herring <[email protected]>
11+
12+
properties:
13+
vendor,property-ms:
14+
description: Array property in common units
15+
minItems: 1
16+
maxItems: 4
17+
items:
18+
enum: [0, 1, 2, 4]
19+
default: [0, 0, 0, 0]
20+
21+
additionalProperties: false

0 commit comments

Comments
 (0)