Skip to content

Commit ecec308

Browse files
committed
fix: pin datamodel-code-generator to 0.25.0 to match original generation
Issue: Models were originally generated with an unknown version of datamodel-code-generator installed globally. When regenerated with v0.43.0, it introduced breaking changes: - Enum → StrEnum (changes string comparison behavior) - Field(...) → Annotated[type, Field(...)] (different syntax) Investigation: Tested versions 0.25.0 through 0.35.0 and found v0.25.0 produces output matching the original generation: - Uses Enum (not StrEnum) - maintains backwards compatibility - Uses Field(..., description=) syntax (not Annotated) - Supports Pydantic v2 RootModel pattern Changes: - Pinned datamodel-code-generator==0.25.0 in pyproject.toml - Removed --use-annotated flag from generation script - Regenerated models with correct version - All model tests now pass (46/46) This ensures: ✓ No breaking changes for customers using EventType, Operator, etc. ✓ Consistent generation across environments ✓ Backwards compatible enum behavior (EventType.model != 'model') ✨ Created with OpenCode
1 parent f7f37bb commit ecec308

File tree

3 files changed

+721
-968
lines changed

3 files changed

+721
-968
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ dev = [
5656
"pre-commit>=3.0.0", # For git hooks
5757
"requests>=2.31.0", # For docs navigation validation
5858
"beautifulsoup4>=4.12.0", # For docs navigation validation
59-
"datamodel-code-generator==0.43.0", # For model generation from OpenAPI spec
59+
"datamodel-code-generator==0.25.0", # For model generation from OpenAPI spec (pinned to match original generation)
6060
"openapi-python-client>=0.28.0", # For SDK generation
6161
"docker>=7.0.0", # For Lambda container tests
6262
]

scripts/generate_v0_models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ def main():
9898
"3.11",
9999
"--output-model-type",
100100
"pydantic_v2.BaseModel",
101-
"--use-annotated",
101+
# Note: --use-annotated flag removed to match original generation style
102+
# Original used Field(..., description=) not Annotated[type, Field(description=)]
102103
]
103104

104105
print(f"Running: {' '.join(cmd)}")

0 commit comments

Comments
 (0)