Lines Matching +full:subset +full:- +full:of
1 .. SPDX-License-Identifier: GPL-2.0
3 Writing Devicetree Bindings in json-schema
6 Devicetree bindings are written using json-schema vocabulary. Schema files are
7 written in a JSON-compatible subset of YAML. YAML is used instead of JSON as it
11 Also see :ref:`example-schema`.
14 ---------------
16 Each schema doc is a structured json-schema which is defined by a set of
17 top-level properties. Generally, there is one binding defined per file. The
18 top-level json-schema properties used are:
21 A json-schema unique identifier string. The string must be a valid
27 components of the current schema file's '$id' value. A URL is used even for
31 Indicates the meta-schema the schema file adheres to.
34 A one-line description of the hardware being described in the binding schema.
37 A DT specific property. Contains a list of email address(es)
38 for maintainers of this binding.
41 Optional. A multi-line text block containing any detailed
46 The YAML format has several options for defining the formatting of the text
62 maintains leading whitespace beyond indentation of the first line. The line
66 style maintains all line breaks and whitespace (beyond indentation of the
69 The above is not a complete description of YAML text blocks. More details on
70 multi-line YAML text blocks can be found online:
72 https://yaml-multiline.info/
77 Optional. A json-schema used to match nodes for applying the
79 compatible-string values or node name. Most bindings should not need select.
82 Optional. A list of other schemas to include. This is used to
84 particular class of devices such as I2C or SPI controllers.
87 A set of sub-schema defining all the DT properties for the
89 common properties (e.g. 'interrupts') or are binding/vendor-specific
101 A list of DT properties from the 'properties' section that
107 have exactly one of these keywords in top-level part, so either
113 binding allows subset of properties from other referenced schemas.
120 Rare case, used for schemas implementing common set of properties. Such
122 'unevaluatedProperties: false'. Typically bus or common-part schemas.
125 Optional. A list of one or more DTS hunks implementing this binding only.
133 ---------------
135 The 'properties' section of the schema contains all the DT properties for a
136 binding. Each property contains a set of constraints using json-schema
138 validation of DT files.
144 Vendor-specific properties will typically need more detailed schema. With the
145 exception of boolean properties, they should have a reference to a type in
148 The Devicetree schemas don't exactly match the YAML-encoded DT data produced by
149 dtc. They are simplified to make them more compact and avoid a bunch of
153 The default for arrays in json-schema is they are variable-sized and allow more
157 number of entries in an 'items' list.
164 ------------
166 Use YAML coding style (two-space indentation). For DTS examples in the schema,
167 preferred is four-space indentation.
170 -------
184 apt install swig python3-dev
186 Several executables (dt-doc-validate, dt-mk-schema, dt-validate) will be
194 The DT schema binding documents must be validated using the meta-schema (the
195 schema for the schema) to ensure they are both valid json-schema and valid
196 binding schema. All of the DT binding documents can be validated using the
201 In order to perform validation of DT source files, use the ``dtbs_check`` target::
213 It is also possible to run checks with a subset of matching schema files by
215 patterns (partial match of a fixed string). Each file or pattern should be
220 make dt_binding_check DT_SCHEMA_FILES=trivial-devices.yaml
221 make dt_binding_check DT_SCHEMA_FILES=trivial-devices.yaml:rtc.yaml
223 make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml
226 json-schema Resources
227 ---------------------
230 `JSON-Schema Specifications <http://json-schema.org/>`_
234 .. _example-schema:
237 ------------------------
239 Also available as a separate file: :download:`example-schema.yaml`
241 .. literalinclude:: example-schema.yaml