Skip to content

Commit 5a30529

Browse files
authored
fix: do not run data regex on names that are passed in (#1848)
1 parent e58b6e9 commit 5a30529

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,4 @@ examples/*.json
146146
*.json
147147
docs/base/models/*
148148
.github/copilot-instructions.md
149+
uv.lock

src/aind_data_schema/core/data_description.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ def subject_id_when_raw(self):
155155

156156
@model_validator(mode="after")
157157
def build_name(self):
158-
"""sets the name of the file"""
158+
"""Set the name of data_description when data_level is RAW and the name is empty"""
159159
if self.name is None and self.data_level == DataLevel.RAW:
160160
self.name = build_data_name(self.subject_id, creation_datetime=self.creation_time)
161161

162-
# check that the name matches the name regex
163-
if not re.match(DataRegex.DATA.value, self.name):
164-
raise ValueError(f"Name({self.name}) does not match allowed Regex pattern")
162+
# check that the name matches the name regex
163+
if not re.match(DataRegex.DATA.value, self.name):
164+
raise ValueError(f"Name({self.name}) does not match allowed Regex pattern")
165165

166166
return self
167167

0 commit comments

Comments
 (0)