Skip to content

Commit fd4ea02

Browse files
committed
fix: set UUID default factory for all data classes
1 parent b6c4be9 commit fd4ea02

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/osw/core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,12 @@ def _fetch_schema(self, fetchSchemaParam: _FetchSchemaParam = None) -> None:
434434
content = f.read()
435435
os.remove(temp_model_path)
436436

437+
content = re.sub(
438+
r"(UUID = Field\(...)",
439+
r"UUID = Field(default_factory=uuid4",
440+
content,
441+
) # enable default value for uuid
442+
437443
if fetchSchemaParam.mode == "replace":
438444
header = (
439445
"from uuid import uuid4\n"
@@ -450,12 +456,6 @@ def _fetch_schema(self, fetchSchemaParam: _FetchSchemaParam = None) -> None:
450456
1,
451457
) # add header before first class declaration
452458

453-
content = re.sub(
454-
r"(UUID = Field\(...)",
455-
r"UUID = Field(default_factory=uuid4",
456-
content,
457-
) # enable default value for uuid
458-
459459
with open(result_model_path, "w", encoding="utf-8") as f:
460460
f.write(content)
461461

0 commit comments

Comments
 (0)