Skip to content

Commit d18eb5f

Browse files
committed
Schema validation 3
1 parent f159ddd commit d18eb5f

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

doc/reference/reference_lua/config/utils_schema.rst

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,14 @@ Scalar and composite types
9494

9595
There are scalar and composite types.
9696

97-
- :ref:`schema.scalar() <config-utils-schema-scalar>`
98-
- :ref:`schema.record() <config-utils-schema-record>`
99-
- :ref:`schema.map() <config-utils-schema-map>`
100-
- :ref:`schema.array() <config-utils-schema-array>`
97+
- Scalar type.
98+
Can be created using ``schema.scalar()``.
99+
There is also a shortcut: :ref:`schema.enum() <config-utils-schema-enum>`.
100+
Learn more about supported data types: :ref:`config_utils_schema_data_types`.
101+
- Composite data types: record, array, map.
102+
Can be created using :ref:`schema.record() <config-utils-schema-record>`, :ref:`schema.array() <config-utils-schema-array>`, :ref:`schema.map() <config-utils-schema-map>`.
103+
There is also a shortcut for arrays: :ref:`schema.set() <config-utils-schema-set>`.
101104

102-
Shortcuts:
103-
104-
- :ref:`schema.enum() <config-utils-schema-enum>`
105-
- :ref:`schema.set() <config-utils-schema-set>`
106105

107106
.. _config_utils_schema_type_system_scalar:
108107

@@ -135,7 +134,7 @@ See also: :ref:`config_utils_schema_data_types`.
135134
Record
136135
^^^^^^
137136

138-
Example config:
137+
Example config 1 (no nested fields - only scalars inside the record):
139138

140139
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/config_schema_nodes_record/config.yaml
141140
:language: yaml
@@ -218,6 +217,8 @@ Schema:
218217
Data types
219218
**********
220219

220+
Passed to ``scalar()``, see :ref:`config_utils_schema_type_system_scalar`.
221+
221222
Supported types:
222223

223224
- ``string`` -- ``string``
@@ -236,6 +237,19 @@ Supported types:
236237
Annotations
237238
***********
238239

240+
3 groups of annotations:
241+
242+
- Built-in annotations handled by the module (``validate``, ``allowed_values``, ``default``, ``apply_default_if``). Note that ``validate``, ``allowed_values`` used for validation only. ``default`` and ``apply_default_if`` can transform the configuration.
243+
- User-defined annotations
244+
- Computed annotations
245+
246+
.. _config_utils_schema_built_in_annotations:
247+
248+
Built-in annotations
249+
^^^^^^^^^^^^^^^^^^^^
250+
251+
TODO: check the ``Built-in annotation`` term.
252+
239253
Example config:
240254

241255
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/config_schema_annotations/config.yaml
@@ -508,7 +522,7 @@ API Reference
508522
* - :ref:`schema_node_object.apply_default_if <config-schema_node_object-apply_default_if>`
509523
- TODO
510524

511-
* - :ref:`schema_node_object.computed.annotations <config-schema_node_object-computed-annotations>`
525+
* - :ref:`schema_node_object.computed <config-schema_node_object-computed>`
512526
- TODO
513527

514528
* - :ref:`schema_node_object.default <config-schema_node_object-default>`
@@ -745,7 +759,7 @@ schema_object
745759

746760
.. data:: schema
747761

748-
TODO
762+
TODO, see also ``schema_node_object``
749763

750764

751765

@@ -806,11 +820,11 @@ schema_node_object
806820

807821
TODO
808822

809-
.. _config-schema_node_object-computed-annotations:
823+
.. _config-schema_node_object-computed:
810824

811-
.. data:: computed.annotations
825+
.. data:: computed
812826

813-
TODO
827+
TODO (for example, ``computed.annotations``)
814828

815829
.. _config-schema_node_object-default:
816830

0 commit comments

Comments
 (0)