Skip to content

Commit 5974e2e

Browse files
committed
Build: (35e96bd) Elaborate on YAML nesting
1 parent 798d93e commit 5974e2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1341
-1250
lines changed

_sources/config/development/config-data.rst.txt

Lines changed: 98 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -357,38 +357,65 @@ Nesting Objects
357357
Because values in maps and items in lists can be of any type, It's
358358
possible to nest maps in maps, lists in lists, lists in maps, and so on.
359359

360-
Here is an example of a ``Map`` contained within the value of another
361-
``Map`` (which is the top level object):
360+
.. tip::
361+
362+
Defining something inside something else is commonly referred to as 'nesting'.
362363

363364
.. tab-set::
364365

365366
.. tab-item:: YAML
366367

367-
.. admonition:: Info
368-
:class: tip
368+
When setting the value of a map, typically it will just fit on the
369+
same line as the key, for example the ``Float`` 42 can just be written
370+
in-line with the key, after the colon like so:
371+
372+
.. code-block:: yaml
369373
370-
For simple data types like integers and strings it is clear which key
371-
corresponds to which value, as they are typically contained on the same
372-
line, but maps and lists may span multiple lines, so we need a way of
373-
defining which objects are defined under which keys and items. In YAML,
374-
we can specify this kind of relationship via *indentation* - which is
375-
simply how many spaces come before the key one a line. We conventionally
376-
use two spaces to indicate 'one level' of indentation in YAML configs.
374+
key: 42
375+
376+
Types that can span multiple lines, such as maps and lists won't fit
377+
on a single line. For example you man want the following map which spans
378+
multiple lines to be a value within another map:
377379

378380
.. code-block:: yaml
379-
:caption: config.yml
380-
:linenos:
381381
382-
parent-key:
383-
child-key: value
384-
sibling-key: another value
382+
foo: a
383+
bar: b
384+
385+
To nest this map as a value of a key, say ``baz``, in another map, it can be
386+
defined under the key with additional indentation like so:
387+
388+
.. code-block:: yaml
389+
390+
baz:
391+
foo: a
392+
bar: b
393+
394+
Indentation / indenting text refers to having some consistent number of spaces before
395+
each line in text. In YAML, the recommended number of spaces to indent is 2 as shown above.
396+
397+
Lists can be nested similarly like so:
398+
399+
.. code-block:: yaml
400+
401+
my-list:
402+
- item 1
403+
- item 2
385404
386-
You can see that the map containing ``child-key`` and ``sibling-key`` is
387-
indented by two spaces, and is defined under the ``parent-key`` key,
388-
signifying that it belongs to that key.
405+
Multiple 'levels of indentation' can be used, for example here is the prior map further
406+
nested under (as the value for the key) ``qux``:
407+
408+
.. code-block:: yaml
409+
410+
qux:
411+
baz:
412+
foo: a
413+
bar: b
389414
390415
.. tab-item:: JSON
391416

417+
Example of a ``Map`` defined in a ``Map``:
418+
392419
.. code-block:: json
393420
:caption: config.json
394421
:linenos:
@@ -400,36 +427,66 @@ Here is an example of a ``Map`` contained within the value of another
400427
}
401428
}
402429
403-
And here is a ``Map`` (the top level object) containing a ``List`` of
404-
``String``\ s:
405-
406-
.. tab-set::
407-
408-
.. tab-item:: YAML
409-
410-
.. code-block:: yaml
411-
:caption: config.yml
412-
:linenos:
413-
414-
list of strings:
415-
- item 1
416-
- item 2
417-
- item 3
418-
419-
.. tab-item:: JSON
430+
Example of a ``List`` defined in a ``Map``:
420431

421432
.. code-block:: json
422433
:caption: config.json
423434
:linenos:
424-
435+
425436
{
426-
"list of strings": [
427-
"item 1",
428-
"item 2",
429-
"item 3"
437+
"my-list": [
438+
"item 1",
439+
"item 2"
430440
]
431441
}
432442
443+
Illegally defining two values for one key
444+
-----------------------------------------
445+
446+
A common mistake in YAML is to accidentally assign two different
447+
values to the same key.
448+
449+
For example the following is invalid:
450+
451+
.. code-block:: yaml
452+
453+
key: foo
454+
baz: bar
455+
456+
The reason this is invalid is because there are two competing values being
457+
assigned to ``key``, which are ``foo`` and the map containing ``baz: bar``.
458+
459+
Deleting one of the values would make this valid YAML:
460+
461+
.. code-block:: yaml
462+
463+
key:
464+
baz: bar
465+
466+
Or
467+
468+
.. code-block:: yaml
469+
470+
key: foo
471+
472+
A config might end up in this invalid state for many reasons.
473+
474+
A key may have been deleted or omitted which could be remedied by re-adding it like so:
475+
476+
.. code-block:: yaml
477+
478+
key: foo
479+
missing:
480+
baz: bar
481+
482+
Indentation may have been changed by accident, for example removing indentation
483+
would make it valid like so:
484+
485+
.. code-block:: yaml
486+
487+
key: foo
488+
baz: bar
489+
433490
Combining Everything
434491
====================
435492

_sources/config/documentation/objects/BiomeColorMapping.rst.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ Uses
3434

3535
Used by 2 parameters:
3636

37-
- :ref:`In EXACT in BiomeColorConverter <object-biomecolorconverter-template-biome-provider-image-v2-exact-parameter-match>`:
37+
- :ref:`In CLOSEST in BiomeColorConverter <object-biomecolorconverter-template-biome-provider-image-v2-closest-parameter-match>`:
3838

39-
:bdg-ref-primary:`match <object-biomecolorconverter-template-biome-provider-image-v2-exact-parameter-match>` :doc:`/config/documentation/objects/BiomeColorMapping`
39+
:bdg-ref-primary:`match <object-biomecolorconverter-template-biome-provider-image-v2-closest-parameter-match>` :doc:`/config/documentation/objects/BiomeColorMapping`
4040

41-
- :ref:`In CLOSEST in BiomeColorConverter <object-biomecolorconverter-template-biome-provider-image-v2-closest-parameter-match>`:
41+
- :ref:`In EXACT in BiomeColorConverter <object-biomecolorconverter-template-biome-provider-image-v2-exact-parameter-match>`:
4242

43-
:bdg-ref-primary:`match <object-biomecolorconverter-template-biome-provider-image-v2-closest-parameter-match>` :doc:`/config/documentation/objects/BiomeColorMapping`
43+
:bdg-ref-primary:`match <object-biomecolorconverter-template-biome-provider-image-v2-exact-parameter-match>` :doc:`/config/documentation/objects/BiomeColorMapping`

_sources/config/documentation/objects/BiomeProvider.rst.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ Uses
132132

133133
Used by 2 parameters:
134134

135-
- :ref:`In base in pack.yml <config-pack.yml-template-base-base-parameter-biomes>`:
135+
- :ref:`In EXTRUSION in BiomeProvider <object-biomeprovider-template-biome-provider-extrusion-extrusion-parameter-provider>`:
136136

137-
:bdg-ref-primary:`biomes <config-pack.yml-template-base-base-parameter-biomes>` :doc:`/config/documentation/objects/BiomeProvider` - Determines where biomes should generate in the world.
137+
:bdg-ref-primary:`provider <object-biomeprovider-template-biome-provider-extrusion-extrusion-parameter-provider>` :doc:`/config/documentation/objects/BiomeProvider`
138138

139-
- :ref:`In EXTRUSION in BiomeProvider <object-biomeprovider-template-biome-provider-extrusion-extrusion-parameter-provider>`:
139+
- :ref:`In base in pack.yml <config-pack.yml-template-base-base-parameter-biomes>`:
140140

141-
:bdg-ref-primary:`provider <object-biomeprovider-template-biome-provider-extrusion-extrusion-parameter-provider>` :doc:`/config/documentation/objects/BiomeProvider`
141+
:bdg-ref-primary:`biomes <config-pack.yml-template-base-base-parameter-biomes>` :doc:`/config/documentation/objects/BiomeProvider` - Determines where biomes should generate in the world.

_sources/config/documentation/objects/Block.rst.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,34 @@ Uses
1414

1515
Used by 8 parameters:
1616

17-
- :ref:`In base in ORE <config-ore-template-config-ore-base-parameter-material-overrides>`:
17+
- :ref:`In base in SCATTERED_ORE <config-scattered_ore-template-config-ore-base-parameter-replace>`:
1818

19-
:bdg-ref-success:`material-overrides <config-ore-template-config-ore-base-parameter-material-overrides>` :doc:`/config/documentation/objects/Map`\<:doc:`/config/documentation/objects/Block`\, :doc:`/config/documentation/objects/Block`\>
19+
:bdg-ref-primary:`replace <config-scattered_ore-template-config-ore-base-parameter-replace>` :doc:`/config/documentation/objects/Set`\<:doc:`/config/documentation/objects/Block`\>
2020

2121
- :ref:`In base in SCATTERED_ORE <config-scattered_ore-template-config-ore-base-parameter-material>`:
2222

2323
:bdg-ref-primary:`material <config-scattered_ore-template-config-ore-base-parameter-material>` :doc:`/config/documentation/objects/Block`
2424

25-
- :ref:`In MATCH in Pattern <object-pattern-template-config-locators-match-parameter-block>`:
26-
27-
:bdg-ref-primary:`block <object-pattern-template-config-locators-match-parameter-block>` :doc:`/config/documentation/objects/Block`
28-
29-
- :ref:`In base in SCATTERED_ORE <config-scattered_ore-template-config-ore-base-parameter-material-overrides>`:
25+
- :ref:`In base in ORE <config-ore-template-config-ore-base-parameter-material>`:
3026

31-
:bdg-ref-success:`material-overrides <config-scattered_ore-template-config-ore-base-parameter-material-overrides>` :doc:`/config/documentation/objects/Map`\<:doc:`/config/documentation/objects/Block`\, :doc:`/config/documentation/objects/Block`\>
27+
:bdg-ref-primary:`material <config-ore-template-config-ore-base-parameter-material>` :doc:`/config/documentation/objects/Block`
3228

33-
- :ref:`In base in SCATTERED_ORE <config-scattered_ore-template-config-ore-base-parameter-replace>`:
29+
- :ref:`In MATCH_SET in Pattern <object-pattern-template-config-locators-match_set-parameter-blocks>`:
3430

35-
:bdg-ref-primary:`replace <config-scattered_ore-template-config-ore-base-parameter-replace>` :doc:`/config/documentation/objects/Set`\<:doc:`/config/documentation/objects/Block`\>
31+
:bdg-ref-primary:`blocks <object-pattern-template-config-locators-match_set-parameter-blocks>` :doc:`/config/documentation/objects/Set`\<:doc:`/config/documentation/objects/Block`\>
3632

3733
- :ref:`In base in ORE <config-ore-template-config-ore-base-parameter-replace>`:
3834

3935
:bdg-ref-primary:`replace <config-ore-template-config-ore-base-parameter-replace>` :doc:`/config/documentation/objects/Set`\<:doc:`/config/documentation/objects/Block`\>
4036

41-
- :ref:`In MATCH_SET in Pattern <object-pattern-template-config-locators-match_set-parameter-blocks>`:
37+
- :ref:`In base in ORE <config-ore-template-config-ore-base-parameter-material-overrides>`:
4238

43-
:bdg-ref-primary:`blocks <object-pattern-template-config-locators-match_set-parameter-blocks>` :doc:`/config/documentation/objects/Set`\<:doc:`/config/documentation/objects/Block`\>
39+
:bdg-ref-success:`material-overrides <config-ore-template-config-ore-base-parameter-material-overrides>` :doc:`/config/documentation/objects/Map`\<:doc:`/config/documentation/objects/Block`\, :doc:`/config/documentation/objects/Block`\>
4440

45-
- :ref:`In base in ORE <config-ore-template-config-ore-base-parameter-material>`:
41+
- :ref:`In MATCH in Pattern <object-pattern-template-config-locators-match-parameter-block>`:
42+
43+
:bdg-ref-primary:`block <object-pattern-template-config-locators-match-parameter-block>` :doc:`/config/documentation/objects/Block`
44+
45+
- :ref:`In base in SCATTERED_ORE <config-scattered_ore-template-config-ore-base-parameter-material-overrides>`:
4646

47-
:bdg-ref-primary:`material <config-ore-template-config-ore-base-parameter-material>` :doc:`/config/documentation/objects/Block`
47+
:bdg-ref-success:`material-overrides <config-scattered_ore-template-config-ore-base-parameter-material-overrides>` :doc:`/config/documentation/objects/Map`\<:doc:`/config/documentation/objects/Block`\, :doc:`/config/documentation/objects/Block`\>

_sources/config/documentation/objects/Boolean.rst.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,46 @@ Uses
1212

1313
Used by 13 parameters:
1414

15-
- :ref:`In GABOR in NoiseSampler <object-noisesampler-template-config-noise-function-gabor-parameter-isotropic>`:
16-
17-
:bdg-ref-success:`isotropic <object-noisesampler-template-config-noise-function-gabor-parameter-isotropic>` :doc:`/config/documentation/objects/Boolean`
18-
19-
- :ref:`In base in SCATTERED_ORE <config-scattered_ore-template-config-ore-base-parameter-physics>`:
15+
- :ref:`In CHANNEL in NoiseSampler <object-noisesampler-template-library-image-channel-parameter-normalize>`:
2016

21-
:bdg-ref-success:`physics <config-scattered_ore-template-config-ore-base-parameter-physics>` :doc:`/config/documentation/objects/Boolean`
17+
:bdg-ref-success:`normalize <object-noisesampler-template-library-image-channel-parameter-normalize>` :doc:`/config/documentation/objects/Boolean` - If the channel should be normalized to range [-1, 1] or not.
2218

2319
- :ref:`In STITCHED_BITMAP in Image <object-image-template-library-image-stitched_bitmap-parameter-zero-indexed>`:
2420

2521
:bdg-ref-success:`zero-indexed <object-image-template-library-image-stitched_bitmap-parameter-zero-indexed>` :doc:`/config/documentation/objects/Boolean`
2622

27-
- :ref:`In DISTANCE in NoiseSampler <object-noisesampler-template-config-noise-function-distance-parameter-normalize>`:
23+
- :ref:`In base in SCATTERED_ORE <config-scattered_ore-template-config-ore-base-parameter-physics>`:
2824

29-
:bdg-ref-success:`normalize <object-noisesampler-template-config-noise-function-distance-parameter-normalize>` :doc:`/config/documentation/objects/Boolean` - If set to true, the returned distance will be normalized to be within the range ``[-1, 1]``, otherwise the raw distance is returned.
25+
:bdg-ref-success:`physics <config-scattered_ore-template-config-ore-base-parameter-physics>` :doc:`/config/documentation/objects/Boolean`
3026

3127
- :ref:`In CHANNEL in NoiseSampler <object-noisesampler-template-library-image-channel-parameter-premultiply>`:
3228

3329
:bdg-ref-success:`premultiply <object-noisesampler-template-library-image-channel-parameter-premultiply>` :doc:`/config/documentation/objects/Boolean` - Whether to multiply color channels by the alpha channel or not.
3430

35-
- :ref:`In base in ORE <config-ore-template-config-ore-base-parameter-physics>`:
31+
- :ref:`In DISTANCE_TRANSFORM in NoiseSampler <object-noisesampler-template-library-image-distance_transform-parameter-invert-threshold>`:
3632

37-
:bdg-ref-success:`physics <config-ore-template-config-ore-base-parameter-physics>` :doc:`/config/documentation/objects/Boolean`
33+
:bdg-ref-success:`invert-threshold <object-noisesampler-template-library-image-distance_transform-parameter-invert-threshold>` :doc:`/config/documentation/objects/Boolean`
3834

3935
- :ref:`In DISTANCE_TRANSFORM in NoiseSampler <object-noisesampler-template-library-image-distance_transform-parameter-clamp-to-max-edge>`:
4036

4137
:bdg-ref-success:`clamp-to-max-edge <object-noisesampler-template-library-image-distance_transform-parameter-clamp-to-max-edge>` :doc:`/config/documentation/objects/Boolean`
4238

43-
- :ref:`In DISTANCE_TRANSFORM in NoiseSampler <object-noisesampler-template-library-image-distance_transform-parameter-invert-threshold>`:
39+
- :ref:`In base in ORE <config-ore-template-config-ore-base-parameter-physics>`:
4440

45-
:bdg-ref-success:`invert-threshold <object-noisesampler-template-library-image-distance_transform-parameter-invert-threshold>` :doc:`/config/documentation/objects/Boolean`
41+
:bdg-ref-success:`physics <config-ore-template-config-ore-base-parameter-physics>` :doc:`/config/documentation/objects/Boolean`
4642

47-
- :ref:`In CHANNEL in NoiseSampler <object-noisesampler-template-library-image-channel-parameter-normalize>`:
43+
- :ref:`In GABOR in NoiseSampler <object-noisesampler-template-config-noise-function-gabor-parameter-isotropic>`:
4844

49-
:bdg-ref-success:`normalize <object-noisesampler-template-library-image-channel-parameter-normalize>` :doc:`/config/documentation/objects/Boolean` - If the channel should be normalized to range [-1, 1] or not.
45+
:bdg-ref-success:`isotropic <object-noisesampler-template-config-noise-function-gabor-parameter-isotropic>` :doc:`/config/documentation/objects/Boolean`
5046

5147
- :ref:`In BITMAP in Image <object-image-template-library-image-bitmap-parameter-zero-indexed>`:
5248

5349
:bdg-ref-success:`zero-indexed <object-image-template-library-image-bitmap-parameter-zero-indexed>` :doc:`/config/documentation/objects/Boolean`
5450

51+
- :ref:`In DISTANCE in NoiseSampler <object-noisesampler-template-config-noise-function-distance-parameter-normalize>`:
52+
53+
:bdg-ref-success:`normalize <object-noisesampler-template-config-noise-function-distance-parameter-normalize>` :doc:`/config/documentation/objects/Boolean` - If set to true, the returned distance will be normalized to be within the range ``[-1, 1]``, otherwise the raw distance is returned.
54+
5555
- :ref:`In ADJACENT_PATTERN in Locator <object-locator-template-config-locators-adjacent_pattern-parameter-match-all>`:
5656

5757
:bdg-ref-success:`match-all <object-locator-template-config-locators-adjacent_pattern-parameter-match-all>` :doc:`/config/documentation/objects/Boolean`

_sources/config/documentation/objects/ColorSampler.rst.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,26 +105,26 @@ Uses
105105

106106
Used by 6 parameters:
107107

108-
- :ref:`In SINGLE_IMAGE in ColorSampler <object-colorsampler-template-library-image-single_image-parameter-outside-sampler>`:
109-
110-
:bdg-ref-primary:`outside-sampler <object-colorsampler-template-library-image-single_image-parameter-outside-sampler>` :doc:`/config/documentation/objects/ColorSampler` - The sampler that provides colors for coordinates outside the bounds of the ``Image`` .
111-
112-
- :ref:`In IMAGE in Source <object-source-template-pipeline-image-image-parameter-color-sampler>`:
108+
- :ref:`In CHANNEL in NoiseSampler <object-noisesampler-template-library-image-channel-parameter-color-sampler>`:
113109

114-
:bdg-ref-primary:`color-sampler <object-source-template-pipeline-image-image-parameter-color-sampler>` :doc:`/config/documentation/objects/ColorSampler`
110+
:bdg-ref-primary:`color-sampler <object-noisesampler-template-library-image-channel-parameter-color-sampler>` :doc:`/config/documentation/objects/ColorSampler` - The color sampler to extract channel values from.
115111

116-
- :ref:`In ROTATE in ColorSampler <object-colorsampler-template-library-image-rotate-parameter-color-sampler>`:
112+
- :ref:`In IMAGE in BiomeProvider <object-biomeprovider-template-biome-provider-image-v2-image-parameter-color-sampler>`:
117113

118-
:bdg-ref-primary:`color-sampler <object-colorsampler-template-library-image-rotate-parameter-color-sampler>` :doc:`/config/documentation/objects/ColorSampler`
114+
:bdg-ref-primary:`color-sampler <object-biomeprovider-template-biome-provider-image-v2-image-parameter-color-sampler>` :doc:`/config/documentation/objects/ColorSampler`
119115

120116
- :ref:`In TRANSLATE in ColorSampler <object-colorsampler-template-library-image-translate-parameter-color-sampler>`:
121117

122118
:bdg-ref-primary:`color-sampler <object-colorsampler-template-library-image-translate-parameter-color-sampler>` :doc:`/config/documentation/objects/ColorSampler`
123119

124-
- :ref:`In IMAGE in BiomeProvider <object-biomeprovider-template-biome-provider-image-v2-image-parameter-color-sampler>`:
120+
- :ref:`In IMAGE in Source <object-source-template-pipeline-image-image-parameter-color-sampler>`:
125121

126-
:bdg-ref-primary:`color-sampler <object-biomeprovider-template-biome-provider-image-v2-image-parameter-color-sampler>` :doc:`/config/documentation/objects/ColorSampler`
122+
:bdg-ref-primary:`color-sampler <object-source-template-pipeline-image-image-parameter-color-sampler>` :doc:`/config/documentation/objects/ColorSampler`
127123

128-
- :ref:`In CHANNEL in NoiseSampler <object-noisesampler-template-library-image-channel-parameter-color-sampler>`:
124+
- :ref:`In SINGLE_IMAGE in ColorSampler <object-colorsampler-template-library-image-single_image-parameter-outside-sampler>`:
125+
126+
:bdg-ref-primary:`outside-sampler <object-colorsampler-template-library-image-single_image-parameter-outside-sampler>` :doc:`/config/documentation/objects/ColorSampler` - The sampler that provides colors for coordinates outside the bounds of the ``Image`` .
127+
128+
- :ref:`In ROTATE in ColorSampler <object-colorsampler-template-library-image-rotate-parameter-color-sampler>`:
129129

130-
:bdg-ref-primary:`color-sampler <object-noisesampler-template-library-image-channel-parameter-color-sampler>` :doc:`/config/documentation/objects/ColorSampler` - The color sampler to extract channel values from.
130+
:bdg-ref-primary:`color-sampler <object-colorsampler-template-library-image-rotate-parameter-color-sampler>` :doc:`/config/documentation/objects/ColorSampler`

0 commit comments

Comments
 (0)