Re: [PATCH 1/2] dt-bindings: power: syscon-reboot: Convert bindings to json-schema

From: Krzysztof Kozlowski
Date: Tue Sep 03 2019 - 09:29:35 EST


On Tue, 3 Sep 2019 at 15:12, Rob Herring <robh+dt@xxxxxxxxxx> wrote:
> > arch/arm/boot/dts/exynos3250-artik5-eval.dt.yaml: syscon-reboot:
> > {'regmap': [[9]], 'mask': [[1]], '$nodename': ['syscon-reboot'],
> > 'value': [[1]], 'offset': [[1024]], 'compatible': ['syscon-reboot']}
> > is valid under each of {'required': ['mask']}, {'required': ['value',
> > 'mask']}, {'required': ['value']}
>
> Ahh, right. 'anyOf' is what we want:
>
> anyOf:
> - required: [ value ]
> - required: [ mask ]

This triggers meta-schema error:

SCHEMA Documentation/devicetree/bindings/processed-schema.yaml
Traceback (most recent call last):
File "/home/kozik/.local/lib/python3.5/site-packages/dtschema/lib.py",
line 429, in process_schema
DTValidator.check_schema(schema)
File "/home/kozik/.local/lib/python3.5/site-packages/dtschema/lib.py",
line 575, in check_schema
raise jsonschema.SchemaError.create_from(error)
jsonschema.exceptions.SchemaError: Additional properties are not
allowed ('anyOf' was unexpected)

Failed validating 'additionalProperties' in metaschema['allOf'][0]:
{'$id': 'http://devicetree.org/meta-schemas/base.yaml#',
'$schema': 'http://json-schema.org/draft-07/schema#',
'additionalProperties': False,
'allOf': [{'$ref': 'http://json-schema.org/draft-07/schema#'}],
'description': 'Metaschema for devicetree binding documentation',
'properties': {'$id': {'pattern':
'http://devicetree.org/schemas/.*\\.yaml#'},
'$schema': {'enum':
['http://devicetree.org/meta-schemas/core.yaml#',

'http://devicetree.org/meta-schemas/base.yaml#']},
'additionalProperties': {'type': 'boolean'},
'allOf': {'items': {'propertyNames': {'enum': ['$ref',
'if',
'then',
'else']}}},
'definitions': True,
'dependencies': True,
'description': True,
'else': True,
'examples': {'items': {'type': 'string'},
'type': 'array'},
'if': True,
'maintainers': {'items': {'format': 'email',
'type': 'string'},
'type': 'array'},
'oneOf': True,
'patternProperties': True,
'properties': True,
'required': True,
'select': {'allOf': [{'$ref':
'http://json-schema.org/draft-07/schema#'},
{'oneOf': [{'properties':
{'properties': True,

'required': True},
'type': 'object'},
{'type': 'boolean'}]}]},
'then': True,
'title': {'maxLength': 100},
'unevaluatedProperties': {'type': 'boolean'}},
'required': ['$id', '$schema', 'title', 'maintainers']}

Best regards,
Krzysztof