Suggestion to establish an official naming convention #1504
Replies: 6 comments 1 reply
-
I like it and agree with the arguments made!👍It's good to have some standardization. But I wasn't notified of the post so I will see if it helps to also tag the @openhab/maintainers. 🙂 |
Beta Was this translation helpful? Give feedback.
-
Other opinions, especially from @openhab/add-ons-maintainers?
|
Beta Was this translation helpful? Give feedback.
-
I like it, as long as we're aware there are a large number of bindings that likely won't be updated to follow it anytime soon, or ever. What's the strategy for bindings that generate dynamic channels, such as MQTT Homie and Home Assistant? I want to improve the legibility of their generated type and channel ids already. It's okay in such cases to not strictly follow the convention, correct? That's less of a question, and more of a statement, since the mapping often needs to be two-way, and while some IDs can translate back and forth correctly without munging, doing something like translating from lower-case-hyphen to camelCase and back may not be lossless. So it's either violating the naming convention a bit, OR the other choice is what is currently done, where type IDs go through an encoding step which will still violate the naming convention, while also making IDs far less readable. Example: I have a channel corresponding to an MQTT config topic at |
Beta Was this translation helpful? Give feedback.
-
@jlaur I agree that it makes sense and there should have been such a convention right from the start, which we unfortunately never established. As for your suggestions: As they reflect the de-facto standard right now, I don't have any change requests. |
Beta Was this translation helpful? Give feedback.
-
As next step, since there has been no vetoes yet, I have created a draft PR: openhab/openhab-docs#2061. Any other opinions before publishing? |
Beta Was this translation helpful? Give feedback.
-
Sorry to be late on this, I have just started to write addons.
to this:
Am I correct? I'm not saying the choices are bad, but wouldn't it feel strange to have two naming conventions in the same XML definition file for a thing type? |
Beta Was this translation helpful? Give feedback.
-
I hereby propose to establish a naming convention for addons for the following reasons:
Historically it seems there has never been an official naming convention. I don't know if there were any previous attempts to gain consensus, but it seems the only documented naming convention is actually one that was never agreed upon for channel ids: openhab/openhab-docs#1492. I have been referencing this when reviewing pull requests, unfortunately without knowing this history.
The goal is to gain consensus and as a result create an official naming convention that should be used for new bindings.
The initial proposal is the following:
lower-case-hyphen
lower-case-hyphen
lower-case-hyphen
lower-case-hyphen
camelCase
camelCase
lower-case-hyphen
UPPER_CASE
lower-case-hyphen.xml
Each of these proposals can be discussed separately. If you agree or disagree to any of them, please add your input (with arguments when disagreeing).
The proposals are mostly based on consistency with the de-facto naming in core, and also in many existing bindings, although there is a lot of variations here.
Additionally some specific arguments up front:
camelCase
allows mapping to config classes while maintaining the usual convention for java field naming (@J-N-K)Beta Was this translation helpful? Give feedback.
All reactions