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

V3.1: Relax matches_id_short regex. #310

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions aas_core_meta/v3_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def matches_ID_short(text: str) -> bool:
"""
Check that :paramref:`text` is a valid short ID.
"""
pattern = f"^[a-zA-Z][a-zA-Z0-9_]*$"
pattern = f"^[a-zA-Z][a-zA-Z0-9_-]*[a-zA-Z0-9_]+$"

return match(pattern, text) is not None

Expand Down Expand Up @@ -1415,8 +1415,8 @@ class Value_data_type(str, DBC):

@invariant(
lambda self: matches_ID_short(self),
"ID-short of Referables shall only feature letters, digits, underscore (``_``); "
"starting mandatory with a letter. *I.e.* ``[a-zA-Z][a-zA-Z0-9_]*``.",
"ID-short of Referables shall only feature letters, digits, hyphen (``-``) and underscore (``_``); "
"starting mandatory with a letter, and not ending with a hyphen, *I.e.* ``^[a-zA-Z][a-zA-Z0-9_-]*[a-zA-Z0-9_]+$``.",
)
class ID_short_type(Name_type, DBC):
"""
Expand Down
Loading