Repository: AllenNeuralDynamics/aind-data-schema

Issue:
schema_version_bump removes the schema_version default=
**Describe the bug**
See title

Hints from issue comments:

Solution patch:
diff --git a/src/aind_data_schema/core/acquisition.py b/src/aind_data_schema/core/acquisition.py
index 8aa20e161..26b0836e6 100644
--- a/src/aind_data_schema/core/acquisition.py
+++ b/src/aind_data_schema/core/acquisition.py
@@ -45,7 +45,7 @@ class Acquisition(AindCoreModel):
 
     _DESCRIBED_BY_URL = AindCoreModel._DESCRIBED_BY_BASE_URL.default + "aind_data_schema/core/acquisition.py"
     describedBy: str = Field(default=_DESCRIBED_BY_URL, json_schema_extra={"const": _DESCRIBED_BY_URL})
-    schema_version: SkipValidation[Literal["1.0.3"]] = Field("1.0.3")
+    schema_version: SkipValidation[Literal["1.0.3"]] = Field(default="1.0.3")
     protocol_id: List[str] = Field(default=[], title="Protocol ID", description="DOI for protocols.io")
     experimenter_full_name: List[str] = Field(
         ...,
diff --git a/src/aind_data_schema/core/data_description.py b/src/aind_data_schema/core/data_description.py
index c6406c459..9acf0987f 100644
--- a/src/aind_data_schema/core/data_description.py
+++ b/src/aind_data_schema/core/data_description.py
@@ -40,7 +40,7 @@ class DataDescription(AindCoreModel):
 
     _DESCRIBED_BY_URL = AindCoreModel._DESCRIBED_BY_BASE_URL.default + "aind_data_schema/core/data_description.py"
     describedBy: str = Field(default=_DESCRIBED_BY_URL, json_schema_extra={"const": _DESCRIBED_BY_URL})
-    schema_version: SkipValidation[Literal["1.0.3"]] = Field("1.0.3")
+    schema_version: SkipValidation[Literal["1.0.3"]] = Field(default="1.0.3")
     license: Literal["CC-BY-4.0"] = Field("CC-BY-4.0", title="License")
 
     platform: Platform.ONE_OF = Field(
diff --git a/src/aind_data_schema/core/instrument.py b/src/aind_data_schema/core/instrument.py
index 8c1b9bec6..a4df94bf7 100644
--- a/src/aind_data_schema/core/instrument.py
+++ b/src/aind_data_schema/core/instrument.py
@@ -35,7 +35,7 @@ class Instrument(AindCoreModel):
 
     _DESCRIBED_BY_URL = AindCoreModel._DESCRIBED_BY_BASE_URL.default + "aind_data_schema/core/instrument.py"
     describedBy: str = Field(default=_DESCRIBED_BY_URL, json_schema_extra={"const": _DESCRIBED_BY_URL})
-    schema_version: SkipValidation[Literal["1.0.3"]] = Field("1.0.3")
+    schema_version: SkipValidation[Literal["1.0.3"]] = Field(default="1.0.3")
 
     instrument_id: Optional[str] = Field(
         default=None,
diff --git a/src/aind_data_schema/core/metadata.py b/src/aind_data_schema/core/metadata.py
index dd106bc06..9d086545d 100644
--- a/src/aind_data_schema/core/metadata.py
+++ b/src/aind_data_schema/core/metadata.py
@@ -71,7 +71,7 @@ class Metadata(AindCoreModel):
 
     _DESCRIBED_BY_URL = AindCoreModel._DESCRIBED_BY_BASE_URL.default + "aind_data_schema/core/metadata.py"
     describedBy: str = Field(default=_DESCRIBED_BY_URL, json_schema_extra={"const": _DESCRIBED_BY_URL})
-    schema_version: SkipValidation[Literal["1.1.1"]] = Field("1.1.1")
+    schema_version: SkipValidation[Literal["1.1.1"]] = Field(default="1.1.1")
     id: UUID = Field(
         default_factory=uuid4,
         alias="_id",
diff --git a/src/aind_data_schema/core/procedures.py b/src/aind_data_schema/core/procedures.py
index 95607f050..d7f196be5 100644
--- a/src/aind_data_schema/core/procedures.py
+++ b/src/aind_data_schema/core/procedures.py
@@ -649,7 +649,7 @@ class Procedures(AindCoreModel):
     _DESCRIBED_BY_URL = AindCoreModel._DESCRIBED_BY_BASE_URL.default + "aind_data_schema/core/procedures.py"
     describedBy: str = Field(default=_DESCRIBED_BY_URL, json_schema_extra={"const": _DESCRIBED_BY_URL})
 
-    schema_version: SkipValidation[Literal["1.1.3"]] = Field("1.1.3")
+    schema_version: SkipValidation[Literal["1.1.3"]] = Field(default="1.1.3")
     subject_id: str = Field(
         ...,
         description="Unique identifier for the subject. If this is not a Allen LAS ID, indicate this in the Notes.",
diff --git a/src/aind_data_schema/core/processing.py b/src/aind_data_schema/core/processing.py
index c2b84fe3c..9a1e8edd3 100644
--- a/src/aind_data_schema/core/processing.py
+++ b/src/aind_data_schema/core/processing.py
@@ -124,7 +124,7 @@ class Processing(AindCoreModel):
 
     _DESCRIBED_BY_URL: str = AindCoreModel._DESCRIBED_BY_BASE_URL.default + "aind_data_schema/core/processing.py"
     describedBy: str = Field(default=_DESCRIBED_BY_URL, json_schema_extra={"const": _DESCRIBED_BY_URL})
-    schema_version: SkipValidation[Literal["1.1.3"]] = Field("1.1.3")
+    schema_version: SkipValidation[Literal["1.1.3"]] = Field(default="1.1.3")
 
     processing_pipeline: PipelineProcess = Field(
         ..., description="Pipeline used to process data", title="Processing Pipeline"
diff --git a/src/aind_data_schema/core/quality_control.py b/src/aind_data_schema/core/quality_control.py
index 5325b8ba6..3325b9043 100644
--- a/src/aind_data_schema/core/quality_control.py
+++ b/src/aind_data_schema/core/quality_control.py
@@ -174,7 +174,7 @@ class QualityControl(AindCoreModel):
 
     _DESCRIBED_BY_URL = AindCoreModel._DESCRIBED_BY_BASE_URL.default + "aind_data_schema/core/quality_control.py"
     describedBy: str = Field(default=_DESCRIBED_BY_URL, json_schema_extra={"const": _DESCRIBED_BY_URL})
-    schema_version: SkipValidation[Literal["1.2.1"]] = Field("1.2.1")
+    schema_version: SkipValidation[Literal["1.2.1"]] = Field(default="1.2.1")
     evaluations: List[QCEvaluation] = Field(..., title="Evaluations")
     notes: Optional[str] = Field(default=None, title="Notes")
 
diff --git a/src/aind_data_schema/core/rig.py b/src/aind_data_schema/core/rig.py
index 4b2be2d02..8674a3d0c 100644
--- a/src/aind_data_schema/core/rig.py
+++ b/src/aind_data_schema/core/rig.py
@@ -51,7 +51,7 @@ class Rig(AindCoreModel):
 
     _DESCRIBED_BY_URL = AindCoreModel._DESCRIBED_BY_BASE_URL.default + "aind_data_schema/core/rig.py"
     describedBy: str = Field(default=_DESCRIBED_BY_URL, json_schema_extra={"const": _DESCRIBED_BY_URL})
-    schema_version: SkipValidation[Literal["1.0.3"]] = Field("1.0.3")
+    schema_version: SkipValidation[Literal["1.0.3"]] = Field(default="1.0.3")
     rig_id: str = Field(
         ...,
         description="Unique rig identifier, name convention: <room>-<apparatus name>-<date modified YYYYMMDD>",
diff --git a/src/aind_data_schema/core/session.py b/src/aind_data_schema/core/session.py
index 8f8ef92ce..9698c2e39 100644
--- a/src/aind_data_schema/core/session.py
+++ b/src/aind_data_schema/core/session.py
@@ -534,7 +534,7 @@ class Session(AindCoreModel):
 
     _DESCRIBED_BY_URL = AindCoreModel._DESCRIBED_BY_BASE_URL.default + "aind_data_schema/core/session.py"
     describedBy: str = Field(default=_DESCRIBED_BY_URL, json_schema_extra={"const": _DESCRIBED_BY_URL})
-    schema_version: SkipValidation[Literal["1.0.3"]] = Field("1.0.3")
+    schema_version: SkipValidation[Literal["1.0.3"]] = Field(default="1.0.3")
     protocol_id: List[str] = Field(default=[], title="Protocol ID", description="DOI for protocols.io")
     experimenter_full_name: List[str] = Field(
         ...,
diff --git a/src/aind_data_schema/core/subject.py b/src/aind_data_schema/core/subject.py
index fb4e422ae..5d96e4421 100644
--- a/src/aind_data_schema/core/subject.py
+++ b/src/aind_data_schema/core/subject.py
@@ -89,7 +89,7 @@ class Subject(AindCoreModel):
 
     _DESCRIBED_BY_URL = AindCoreModel._DESCRIBED_BY_BASE_URL.default + "aind_data_schema/core/subject.py"
     describedBy: str = Field(default=_DESCRIBED_BY_URL, json_schema_extra={"const": _DESCRIBED_BY_URL})
-    schema_version: SkipValidation[Literal["1.0.2"]] = Field("1.0.2")
+    schema_version: SkipValidation[Literal["1.0.2"]] = Field(default="1.0.2")
     subject_id: str = Field(
         ...,
         description="Unique identifier for the subject. If this is not a Allen LAS ID, indicate this in the Notes.",
diff --git a/src/aind_data_schema/utils/schema_version_bump.py b/src/aind_data_schema/utils/schema_version_bump.py
index e3ee33fc3..36e78e7f2 100644
--- a/src/aind_data_schema/utils/schema_version_bump.py
+++ b/src/aind_data_schema/utils/schema_version_bump.py
@@ -102,7 +102,9 @@ def _get_updated_file(python_file_path: str, new_ver: str) -> list:
             file_lines = f.readlines()
         for line in file_lines:
             if "schema_version: SkipValidation[Literal[" in str(line):
-                new_line_str = f'    schema_version: SkipValidation[Literal["{new_ver}"]] = Field("{new_ver}")\n'
+                new_line_str = (
+                    f'    schema_version: SkipValidation[Literal["{new_ver}"]] = Field(default="{new_ver}")\n'
+                )
                 new_line = new_line_str.encode()
             else:
                 new_line = line


Test patch:
diff --git a/tests/test_bump_schema_versions.py b/tests/test_bump_schema_versions.py
index 6401de7d3..fec955bb1 100644
--- a/tests/test_bump_schema_versions.py
+++ b/tests/test_bump_schema_versions.py
@@ -77,10 +77,10 @@ def test_update_files(self, mock_write: MagicMock):
         handler._update_files({Subject: new_subject_version, Session: new_session_version})
 
         expected_line_change0 = (
-            f'schema_version: SkipValidation[Literal["{new_subject_version}"]] = Field("{new_subject_version}")'
+            f'schema_version: SkipValidation[Literal["{new_subject_version}"]] = Field(default="{new_subject_version}")'
         )
         expected_line_change1 = (
-            f'schema_version: SkipValidation[Literal["{new_session_version}"]] = Field("{new_session_version}")'
+            f'schema_version: SkipValidation[Literal["{new_session_version}"]] = Field(default="{new_session_version}")'
         )
 
         mock_write_args0 = mock_write.mock_calls[0].args