Skip to content

YAML model repository: supports only version 1 with elements as map #4807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 18, 2025

Conversation

lolodomo
Copy link
Contributor

To be merged once the upgrade tool is available

@lolodomo lolodomo requested a review from a team as a code owner May 11, 2025 10:29
@lolodomo
Copy link
Contributor Author

This PR has to be merged after #4762

To be merged once the upgrade tool is available

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
@lolodomo lolodomo force-pushed the yaml_config_remove_list branch from 03782a4 to 2a01e34 Compare May 11, 2025 12:13
@jimtng
Copy link
Contributor

jimtng commented May 12, 2025

What would happen if a yaml file is found with tags in array syntax (e.g. the upgrade tool failed or didn't run)?

@lolodomo
Copy link
Contributor Author

@lolodomo
Copy link
Contributor Author

Would you like to add a specific warning log?

@jimtng
Copy link
Contributor

jimtng commented May 12, 2025

A warning might be good

@kaikreuzer
Copy link
Member

@lolodomo May I ask you to rebase this in order to resolve the merge conflict?

@kaikreuzer kaikreuzer added the enhancement An enhancement or new feature of the Core label May 18, 2025
@lolodomo
Copy link
Contributor Author

@lolodomo May I ask you to rebase this in order to resolve the merge conflict?

Done

Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

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

Thanks!

@kaikreuzer kaikreuzer merged commit 53ddb0c into openhab:main May 18, 2025
4 checks passed
@kaikreuzer kaikreuzer added this to the 5.0 milestone May 18, 2025
@lolodomo lolodomo deleted the yaml_config_remove_list branch May 18, 2025 18:46
lolodomo added a commit to lolodomo/openhab-core that referenced this pull request May 18, 2025
Required after the merge of PR openhab#4807 and PR openhab#4776

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
logger.trace("Element {} in model {} is not a container object, ignoring it", elementName,
if (!node.isContainerNode() || node.isArray()) {
// all processable sub-elements are container nodes (not array)
logger.trace("Element {} in model {} is not a container object, ignoring it", elementName,
Copy link
Contributor

Choose a reason for hiding this comment

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

@lolodomo I think this should be a warn as well, I just tested my "old" V1 rules, and nothing was logged until I turned on trace. I know that the file is no longer valid, but using an array instead of a map is an "easy mistake to make" for users, and as it is logged it seems like everything is OK, but the element is ignored and doesn't show up.

Copy link
Contributor Author

@lolodomo lolodomo May 18, 2025

Choose a reason for hiding this comment

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

Probably not wished generally but could be a good idea in case of a node we are knowing. So could be useful for node "things" but not for node "dummy".

Copy link
Contributor

@Nadahar Nadahar May 18, 2025

Choose a reason for hiding this comment

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

I don't know what "the general wishes" regarding logging are, but I think it's important that users get feedback when they make a mistake so that they can correct it. All that is logged now is "Adding YAML model " (INFO) and then nothing that indicates that something went wrong. But the object never shows up in the system.

Edit: As I understand you, to do that, you'd have to maintain a list of "known node names" to check against? What if the user misspells the node name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not against a general warning finally.

holgerfriedrich pushed a commit that referenced this pull request May 18, 2025
Required after the merge of PR #4807 and PR #4776

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants