[yamlcomposer] Add !for loops, scoped local variables (!var), and enhance conditionals (!elseif, !else) - #21408
Merged
Merged
Conversation
jimtng
force-pushed
the
yamlcomposer-loops
branch
from
August 16, 2026 09:25
84e3953 to
3c50d2b
Compare
!for loop support and a simplified !if/!elseif/!else syntax!for) and enhance Conditionals
Collaborator
|
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
jimtng
marked this pull request as ready for review
August 16, 2026 09:50
jimtng
force-pushed
the
yamlcomposer-loops
branch
from
August 16, 2026 10:14
3c50d2b to
1d17beb
Compare
jimtng
force-pushed
the
yamlcomposer-loops
branch
6 times, most recently
from
August 17, 2026 09:59
f587b97 to
abddf22
Compare
Contributor
Author
|
rebased |
jimtng
force-pushed
the
yamlcomposer-loops
branch
from
August 21, 2026 02:01
fe8cff1 to
957c21b
Compare
!for) and enhance Conditionals!if, !else, !for) and local variables (!var)
jimtng
force-pushed
the
yamlcomposer-loops
branch
3 times, most recently
from
August 21, 2026 04:32
2b49b05 to
1eca69a
Compare
jimtng
force-pushed
the
yamlcomposer-loops
branch
from
August 21, 2026 04:53
1eca69a to
9fbd162
Compare
!if, !else, !for) and local variables (!var)!for loops, scoped local variables (!var), and enhance conditionals (!elseif, !else)
lsiepel
requested changes
Aug 21, 2026
lsiepel
left a comment
Contributor
There was a problem hiding this comment.
My codex friend looked at it and found these three comments.
This is an initial AI-assisted review.
lsiepel
reviewed
Aug 21, 2026
jimtng
force-pushed
the
yamlcomposer-loops
branch
2 times, most recently
from
August 22, 2026 00:46
915763d to
80816f9
Compare
…local variables (`!var`), `range()` function, and `enumerate` support Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
…ainState parameter Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
…g parser Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
…!else ~:` syntax Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
jimtng
force-pushed
the
yamlcomposer-loops
branch
from
August 22, 2026 20:10
5d9b457 to
e10f46a
Compare
Contributor
Author
|
rebased |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces several significant enhancements to the YAML Composer, focusing on dynamic content generation, improved conditional logic, and expanded expression support.
Key Features
!for): Add a new directive that allows for dynamic sequence iteration and templating within YAML definitions.!if: Introduce a shorthand form for the!iftag to streamline conditional blocks and improve readability.range()functions and Ruby-style range syntax ([1..5]for inclusive and[1...5]for exclusive ranges).enumerateas both a filter and a function, supporting list and map iteration with.keyand.valueaccessors.!var): Introduce the!vardirective to declare scoped variables within maps or list contexts, improving modularity and local configuration reuse.Internal Changes
!forand!if.Examples:
Output: