Skip to content
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

Consistent ordering of entries in jsondb to ensure minimal delta #2436

Closed
ssalonen opened this issue Jul 23, 2021 · 0 comments · Fixed by #2437
Closed

Consistent ordering of entries in jsondb to ensure minimal delta #2436

ssalonen opened this issue Jul 23, 2021 · 0 comments · Fixed by #2437

Comments

@ssalonen
Copy link
Contributor

ssalonen commented Jul 23, 2021

As discussed in https://community.openhab.org/t/storing-configuration-userdata-in-git/124727/, we can sometimes experience "unexpected" re-ordering of JSON objects entries in jsondb.

This is on its own very unharmful on its own, as no program or application should rely on the order of entries of JSON objects. openHAB will naturally parse the JSON to corresponding Java Map or similar, no matter what is the literal order in the file.

Similar problem most likely exists with JSON arrays and Java Set's, although the JSON object structure is much more utilized by openHAB based on a quick glance.

However, the unexpected re-ordering of entries causes unnecessary changes (changes in file content with no impact to runtime), and makes it harder to audit the "real" changes with certain tools such as git diff.

PR to follow.

ssalonen added a commit to ssalonen/openhab-core that referenced this issue Jul 23, 2021
Resolves openhab#2436.

Signed-off-by: Sami Salonen <ssalonen@gmail.com>
kaikreuzer pushed a commit that referenced this issue Aug 8, 2021
* Consistent ordering of entries in jsondb

Resolves #2436.

Signed-off-by: Sami Salonen <ssalonen@gmail.com>
ghys pushed a commit to ghys/openhab-core that referenced this issue Sep 9, 2021
* Consistent ordering of entries in jsondb

Resolves openhab#2436.

Signed-off-by: Sami Salonen <ssalonen@gmail.com>
ssalonen added a commit to ssalonen/openhab2-addons that referenced this issue Sep 17, 2022
Similar to openhab/openhab-core#2436, we want
to have consistent ordering of data in JSONDB. This is fixing the jsondb
order for mqtt.homeassistant discovery results, specifically, the
"topics" property.

In addition, this PR introduces more simple label for things, instead of
"My Sensor (Sensor, Sensor, Sensor, Sensor, Sensor)" we have simply
"Me Sensor (5x Sensor)".
ssalonen added a commit to ssalonen/openhab2-addons that referenced this issue Sep 17, 2022
Similar to openhab/openhab-core#2436, we want
to have consistent ordering of data in JSONDB. This is fixing the jsondb
order for mqtt.homeassistant discovery results, specifically, the
"topics" property.

Signed-off-by: Sami Salonen <ssalonen@gmail.com>
lolodomo pushed a commit to openhab/openhab-addons that referenced this issue Sep 18, 2022
* [mqtt.homeassistant] Stable jsondb serialization for discovery results

Similar to openhab/openhab-core#2436, we want
to have consistent ordering of data in JSONDB. This is fixing the jsondb
order for mqtt.homeassistant discovery results, specifically, the
"topics" property.

* [mqtt.homeassistant] order using full topic string, not by subcomponent

Signed-off-by: Sami Salonen <ssalonen@gmail.com>
leifbladt pushed a commit to leifbladt/openhab-addons that referenced this issue Oct 15, 2022
* [mqtt.homeassistant] Stable jsondb serialization for discovery results

Similar to openhab/openhab-core#2436, we want
to have consistent ordering of data in JSONDB. This is fixing the jsondb
order for mqtt.homeassistant discovery results, specifically, the
"topics" property.

* [mqtt.homeassistant] order using full topic string, not by subcomponent

Signed-off-by: Sami Salonen <ssalonen@gmail.com>
seime pushed a commit to seime/openhab2-addons that referenced this issue Oct 16, 2022
* [mqtt.homeassistant] Stable jsondb serialization for discovery results

Similar to openhab/openhab-core#2436, we want
to have consistent ordering of data in JSONDB. This is fixing the jsondb
order for mqtt.homeassistant discovery results, specifically, the
"topics" property.

* [mqtt.homeassistant] order using full topic string, not by subcomponent

Signed-off-by: Sami Salonen <ssalonen@gmail.com>
andan67 pushed a commit to andan67/openhab-addons that referenced this issue Nov 6, 2022
* [mqtt.homeassistant] Stable jsondb serialization for discovery results

Similar to openhab/openhab-core#2436, we want
to have consistent ordering of data in JSONDB. This is fixing the jsondb
order for mqtt.homeassistant discovery results, specifically, the
"topics" property.

* [mqtt.homeassistant] order using full topic string, not by subcomponent

Signed-off-by: Sami Salonen <ssalonen@gmail.com>
andrasU pushed a commit to andrasU/openhab-addons that referenced this issue Nov 12, 2022
* [mqtt.homeassistant] Stable jsondb serialization for discovery results

Similar to openhab/openhab-core#2436, we want
to have consistent ordering of data in JSONDB. This is fixing the jsondb
order for mqtt.homeassistant discovery results, specifically, the
"topics" property.

* [mqtt.homeassistant] order using full topic string, not by subcomponent

Signed-off-by: Sami Salonen <ssalonen@gmail.com>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
psmedley pushed a commit to psmedley/openhab-addons that referenced this issue Feb 23, 2023
* [mqtt.homeassistant] Stable jsondb serialization for discovery results

Similar to openhab/openhab-core#2436, we want
to have consistent ordering of data in JSONDB. This is fixing the jsondb
order for mqtt.homeassistant discovery results, specifically, the
"topics" property.

* [mqtt.homeassistant] order using full topic string, not by subcomponent

Signed-off-by: Sami Salonen <ssalonen@gmail.com>
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this issue Feb 28, 2023
* [mqtt.homeassistant] Stable jsondb serialization for discovery results

Similar to openhab/openhab-core#2436, we want
to have consistent ordering of data in JSONDB. This is fixing the jsondb
order for mqtt.homeassistant discovery results, specifically, the
"topics" property.

* [mqtt.homeassistant] order using full topic string, not by subcomponent

Signed-off-by: Sami Salonen <ssalonen@gmail.com>
splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this issue Jul 11, 2023
* Consistent ordering of entries in jsondb

Resolves openhab#2436.

Signed-off-by: Sami Salonen <ssalonen@gmail.com>
GitOrigin-RevId: 4bcf486
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 a pull request may close this issue.

1 participant