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

[BREAKING] Device Factory enhancements #297

Closed
wants to merge 7 commits into from

Conversation

tcalmant
Copy link
Contributor

@tcalmant tcalmant commented Jan 2, 2024

This PR provides two changes decided after discussions with @juergen-albert about a better integration of the Device Factory with EMF:

  • BREAKING: Model/Provider/Service/Resource names now follow the Java identifiers specification
    • As names are integrated into EMF, they must be valid Java identifiers
    • Invalid characters are now replaced by an underscore (_) instead of a hyphen (-)
    • A new mapping option has been added: names.ascii
      • If true, names are ensured to be only ASCII letters, digits or underscores. Diacritics are normalized first.
      • If false (default), names are Java identifier characters (see Character.isJavaIdentifierPart) or underscores
    • If a name is a Java reserved keyword or if it starts with a digit, it is then prefixed by an underscore.
  • NEW: Added a model.raw mapping option, that disables the normalization of the @model content. This allows to use URLs as models.

Note: this is currently a draft PR, the documentation has to be updated

* Invalid characters are now replaced by an underscore (_) instead of a
  hyphen (-). This matches the Java identifier format used in EMF.
* By default, all Java identifier characters are now allowed. This means
  that the name of a model, provider, service or resource can use locale
  characters (greek letters, accents, ...).
* A new boolean mapping option is available: "names.ascii". If true, the
  only characters allowed in names are ASCII letters and digits, and the
  underscore. The names are first normalized in NFKD form to remove
  diacritics, then all unexpected characters are replaced by an
  underscore.
* In both modes, ASCII or Java identifiers: if the name is a reserved
  Java keyword or starts with digit, then it is prefixed with an
  underscore.

Tests have been added to check the new behaviours.
If "model.raw" is set to true, then the model string is not sanitized.
This allows to give existing URLs as models instead of simple names.
@tcalmant tcalmant marked this pull request as ready for review January 3, 2024 13:23
@tcalmant
Copy link
Contributor Author

Closed as not necessary since #324

@tcalmant tcalmant closed this Feb 16, 2024
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 this pull request may close these issues.

1 participant