Skip to content

Allow rule with no trigger in DSL Rule file format#5462

Open
lolodomo wants to merge 2 commits intoopenhab:mainfrom
lolodomo:dsl_rule_no_trigger
Open

Allow rule with no trigger in DSL Rule file format#5462
lolodomo wants to merge 2 commits intoopenhab:mainfrom
lolodomo:dsl_rule_no_trigger

Conversation

@lolodomo
Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
@lolodomo lolodomo requested a review from a team as a code owner March 30, 2026 13:40
@dilyanpalauzov
Copy link
Copy Markdown
Contributor

This is requested by #3655.


If there are no triggers, then when should be optional.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the openHAB DSL rules grammar to allow rule declarations whose when section contains no triggers, and adds integration tests to validate that such rules are loaded with an empty trigger list.

Changes:

  • Make the EventTrigger list in the when clause optional in Rules.xtext.
  • Extend existing rule-loading assertions to check trigger/action list sizes.
  • Add an integration test covering a rule with no triggers (when immediately followed by then).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
itests/org.openhab.core.model.rule.tests/src/main/java/org/openhab/core/model/rule/runtime/DSLRuleProviderTest.java Adds coverage for “no trigger” DSL rules and strengthens assertions for trigger/action list sizes.
bundles/org.openhab.core.model.rule/src/org/openhab/core/model/rule/Rules.xtext Updates Xtext grammar so when can contain zero triggers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

… parameter

It was already called with StandardCharsets.UTF_8 for certain tests in that test class.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants