Repository: aas-core-works/aas-core-meta (language: python)

Issue:
Misleading error message on validation of MultiLanguageProperty
The value of a MultiLanguageProperty must have unique entries for each language.

The invariant checking this is currently named "Value specifies no duplicate languages." 
https://aas-core-works.github.io/aas-core-meta/v3/MultiLanguageProperty.html

An according validation error log enrty would be: "Invariant violated:Value specifies no duplicate languages."

This is misleading since it may be interpreted as if the current value does not but should specify duplicate languages.
(At least I did so when I first encountered this ;))

Suggestion: please name the invariant "Value must specifiy no duplicate languages." or even better "Value must specify unique languages."


Discussion / hints:
Thanks, @CHRiSLY78!

We are currently busy around Christmas/New Year, but I'll fix this issue in January 2024 together with a couple of other minor pending issues.

Fix patch:
diff --git a/aas_core_meta/v3.py b/aas_core_meta/v3.py
index ff4cda5e..6a1d6773 100644
--- a/aas_core_meta/v3.py
+++ b/aas_core_meta/v3.py
@@ -1611,7 +1611,7 @@ def __init__(self, extensions: Optional[List["Extension"]] = None) -> None:
     lambda self:
     not (self.display_name is not None)
     or lang_strings_have_unique_languages(self.display_name),
-    "Display name specifies no duplicate languages."
+    "Display name must specify unique languages."
 )
 @invariant(
     lambda self:
@@ -1623,7 +1623,7 @@ def __init__(self, extensions: Optional[List["Extension"]] = None) -> None:
     lambda self:
     not (self.description is not None)
     or lang_strings_have_unique_languages(self.description),
-    "Description specifies no duplicate languages."
+    "Description must specify unique languages."
 )
 @invariant(
     lambda self:
@@ -3062,7 +3062,7 @@ def __init__(
     lambda self:
     not (self.value is not None)
     or lang_strings_have_unique_languages(self.value),
-    "Value specifies no duplicate languages."
+    "Value must specify unique languages."
 )
 # fmt: on
 class Multi_language_property(Data_element):
@@ -5501,7 +5501,7 @@ def is_BCP_47_for_english(text: str) -> bool:
 @invariant(
     lambda self:
     lang_strings_have_unique_languages(self.preferred_name),
-    "Preferred name specifies no duplicate languages."
+    "Preferred name must specify unique languages."
 )
 @invariant(
     lambda self:
@@ -5512,7 +5512,7 @@ def is_BCP_47_for_english(text: str) -> bool:
     lambda self:
     not (self.short_name is not None)
     or lang_strings_have_unique_languages(self.short_name),
-    "Short name specifies no duplicate languages."
+    "Short name must specify unique languages."
 )
 @invariant(
     lambda self:
@@ -5524,7 +5524,7 @@ def is_BCP_47_for_english(text: str) -> bool:
     lambda self:
     not (self.definition is not None)
     or lang_strings_have_unique_languages(self.definition),
-    "Definition specifies no duplicate languages."
+    "Definition must specify unique languages."
 )
 @invariant(
     lambda self:


Test patch:
diff --git a/tests/test_v3.py b/tests/test_v3.py
index 52f104d2..411645f8 100644
--- a/tests/test_v3.py
+++ b/tests/test_v3.py
@@ -1402,7 +1402,7 @@ def test_that_all_list_of_lang_strings_are_lang_string_sets(self) -> None:
                 # fmt: on
 
                 expected_description = (
-                    f"{human_readable_prop_name} specifies no duplicate languages."
+                    f"{human_readable_prop_name} must specify unique languages."
                 )
 
                 if invariant.description is None: