Skip to content

Commit 5ed6e0b

Browse files
committed
update pattern extraction
1 parent da2e667 commit 5ed6e0b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

synapseclient/extensions/curator/schema_generation.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,6 +2893,7 @@ def define_data_model_relationships(self) -> dict:
28932893
allowed_values: A list of values the entry must be one of
28942894
edge_dir: str, 'in'/'out' is the edge an in or out edge. Define for edge relationships
28952895
jsonld_dir: str, 'in'/out is the direction in or out in the JSONLD.
2896+
pattern: regex pattern that the entry must match
28962897
"""
28972898
map_data_model_relationships = {
28982899
"displayName": {
@@ -4866,6 +4867,14 @@ def __post_init__(self) -> None:
48664867
)
48674868
self.logger.warning(msg)
48684869

4870+
if self.pattern:
4871+
try:
4872+
re.compile(self.pattern)
4873+
except re.error as e:
4874+
raise ValueError(
4875+
f"The regex pattern '{self.pattern}' for property '{self.name}' is invalid."
4876+
) from e
4877+
48694878
def _determine_type_and_array(
48704879
self, column_type: Optional[ColumnType]
48714880
) -> tuple[Optional[AtomicColumnType], Optional[bool]]:

0 commit comments

Comments
 (0)