-
-
Notifications
You must be signed in to change notification settings - Fork 432
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
Add restrictions for semantic point/property tags on channels #4615
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Andrew Fiddian-Green <[email protected]>
Signed-off-by: Andrew Fiddian-Green <[email protected]>
If we want to be even more precise, only allow one Point, and one Property. This would avoid having two Points / two properties. furthermore, perhaps Property can only be added with a Point, not alone. I don't know how tricky this would be though. |
The list of tags here can be updated by generateTagClasses.groovy |
Fully agreed. I just can't figure out the XSD syntax to specify that. Problem is that one could split the allowed values into two separate enums, but it is not allowed to have two xml elements of the same name 'tag' each being differently linked to those different enums. (If there are any XSD gurus please speak up). EDIT: After much checking with online XML validators I can confirm that the current OH schema for semantic tags is not really compliant, and cannot disambiguate single usage of property vs. point tags. Given the following two enumerations for
Then this is NOT allowed..
Whereas this IS allowed..
The problem is the inabilility to disabiguate two elements of the same name 'tag' that have different allowed value sets. So we could either ..
|
Signed-off-by: Andrew Fiddian-Green <[email protected]>
Please see #4617 also. |
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/openhab-5-semantic-model-proposal/162526/96 |
Also another idea... probably crazy, we can probably write a validation script before build time. |
Uh. No. The accepted answer is as follows; and in our case we can neither give the elements different names, nor put them in different contexts. Unless we want to completely re-engineer the schema (which I do not not..)
|
Not so crazy. I remember we did something similar with the addon suggestion finder code. AFAIR someone wrote a script that pools all the XML from all of the individual EDIT: here.. Line 63 in fd53c4c
EDIT2: unfortunately after checking that code further I can see that the |
Signed-off-by: Andrew Fiddian-Green <[email protected]>
Signed-off-by: Andrew Fiddian-Green <[email protected]>
Signed-off-by: Andrew Fiddian-Green <[email protected]>
@jimtng I don't think my idea for a validator (above) is going to work. So do you have any further thoughts about your pre-build script idea? .. Another idea is to check the tags when the channel class is instantiated; but this would be problematic since by the time of instantiation the user may well have added custom (e.g. location) tags.. |
Signed-off-by: Andrew Fiddian-Green <[email protected]>
The generator script could also update this xsd file - after this PR has been merged, so it has the correct section to insert into. |
Wow that's cool. But I may need your help to write that script, as it is a language I have not yet studied. |
Sure, I'll be happy to. |
Does the xsd file not supposed to have one blank line at the end? |
I guess it should have a return at the end. Albeit that the current version does not have one. |
Weird, my build is complaining about it and running spotless:apply added the missing blank line |
Signed-off-by: Andrew Fiddian-Green <[email protected]>
Signed-off-by: Andrew Fiddian-Green <[email protected]>
Add XSD schema restrictions for semantic tags on channel type definitions
See also #4616 #4619 #4622
Signed-off-by: Andrew Fiddian-Green [email protected]