-
Notifications
You must be signed in to change notification settings - Fork 27
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
Relaxation of idShort restrictions (Constraint AASd-002) #295
Comments
There is a third reason:
We additionally do have a display name (in different languages even) for more elaborate names |
Mitigation to the third reason: JSON key names are very flexible, e.g. spaces are also permitted ":", "-" etc.. Also see rfc8259
I know, but it's not the same, as display names are mainly used for (human-readable) UI purposes. This is more about keeping the naming convention for idShorts, especially for terms/variables that already exist, e.g. from standards. Many RFC and W3C standards use variable names which include "-" and ":" characters. In terms of interoperability and understandability, it would be nice if established names could be used as is. |
Discussion in Workstream AAS on 2023-11-23
Proposal: allow "-" Wish for 4.0: Decision: idShort of Referables shall only feature letters, digits, hyphen ("-") and To be checked: regular expression with "-": correct like this? |
this should be the right regular expression:
|
I think the regular expression is not backward compatible because it requests at least two characters (we relaxed this constraint with V3.0RC02) ^[a-zA-Z] ([a-zA-Z0-9_-][a-zA-Z0-9_]+ | [a-zA-Z0-9_] ) $ |
Another issue: in Annex C Backus-Naur-Form we do not explain the characters ^ and $. What do they mean? |
see #295 for backward compatibility reasons idShort can end with an underscore. Additionally also 1 char idShorts are allowed.
see decision #295 (comment)
For SMT submodel elements (see https://industrialdigitaltwin.org/en/content-hub/create-a-submodel) also other special characters like "{000}" are used. Alternatives: For a) and c) the question is how strict to make it: just |
* * (Editorial) MultiLanguageNameType inconsistent description, maxLength=128 (schemata were correct) ([#313](#313)) * (Editorial) HasKind/kind explanataroy text: use template, not type ([#313](#313)) * (Editorial) DataTypeDefXsd links now correctly to xmlschema11-2, not to xsd V1.1 ([#312](#312)) + minor editorial changes * New value "Role" in Enumeration AssetKind (#294) * add new value "AssetKind" enumeration "Role" #294 Change PathType to allow not only file: #299 * Identifier: change length from 2000 to 2024 characters #299 * allow hyphens in idShort of Referables #295 * make Entity/entityType optional #287 * editorial change, add missing link to issue #295 * Update Constraint AASd-014 (part 2 of #287) * EmbeddedDataSpecification/dataSpecification now mandatory #296 * Update Change Appendix w.r.t. EmbeddedDataSpecifcation/dataSpecification (now mandatory) #296 * #296 update Changes Section * Editorial changes #313 * semanticId of specificAssetId with name "globalAssetId" #298 * Correct AASd-002 see #295 for backward compatibility reasons idShort can end with an underscore. Additionally also 1 char idShorts are allowed. * path .Specification.pdf remove \ * fix typo
The pattern I have proposed takes this restriction into account with at least two characters. You can test this with this tool: https://regex101.com/ One character --> no match Two character --> match |
A good catch. I would prefer to make an exception for templates. On the other hand, it becomes inconsistent if we have different variants of constraints depending on the AAS form (template/instance/type). We should discuss this in the next meeting. |
This is exactly NOT valid, 1-letter idShorts are valid as well |
Sorry, I misunderstood. However, your proposed reg expression above do not allow 1-letter idShort either. This version should work:
|
Previously, the `matches_id_short` regular expression only allowed letters, digits and underscores. With the decision of [aas-specs#295](admin-shell-io/aas-specs#295), this condition was relaxed to allow also hyphens. Fixes #304
Previously, the `matches_id_short` regular expression only allowed letters, digits and underscores. With the decision of [aas-specs#295](admin-shell-io/aas-specs#295), this condition was relaxed to allow also hyphens. Fixes #304
Previously, the `matches_id_short` regular expression only allowed letters, digits and underscores. With the decision of [aas-specs#295](admin-shell-io/aas-specs#295), this condition was relaxed to allow also hyphens. Fixes #304
the regex is: ^[a-zA-Z][a-zA-Z0-9_-]*[a-zA-Z0-9_]+$ |
What
idShort is currently very restricted defined in the specification:
idShorts like "min-temperature-value" or "modbus:function" are not allowed.
idShorts have a variable-like character. However, I cannot follow why only "_" is allowed as a special character. This complicates the reusage of existing names (that are also variable-like characters), e.g., from standards that uses prefixes.
I tried to understand, where the restrictions come from and I received two resealable answers so far.:
Mitigation
Point 1 is not really a justification for this restriction, URL path allows many special characters such as “-”, “$”, “:” etc
Point 2 is more justifiable. However, it is hard to generalize this, since some programming languages allow “$” in variable names. But seriously questions: Why should idShort names identical be reflected as variable names in a programming language? Which tool/lib is doing this? AAS comes with its own serialization approaches. It makes more sense to reflect the serialization model in a programmatically manner (if needed).
Proposal
It makes sense, that idShorts have a variable-like character, however, more flexibility of the idShort values would be desirable, e.g., to adhere existing name conventions that uses also “-” and “:” in the name value.
Proposal 1: Allow more special characters such as “-” and “:”
and/or
Proposal 2: Allow “%” --> allows URL encoding (all special characters can be reflected)
Note: Proposal 1 and 2 are backward compatible!
The text was updated successfully, but these errors were encountered: