|
| 1 | +# Release Notes v0.7.1 |
| 2 | + |
| 3 | +## 🎉 Major Changes |
| 4 | + |
| 5 | +### Removed Key Transformation Layer |
| 6 | +Removed the `_transform_keys_in_data()` function that was lowercasing all API response keys. Models now directly use the MLB Stats API's native `camelCase` format, simplifying the codebase and ensuring accurate representation of API responses. |
| 7 | + |
| 8 | +### Complete Pydantic Migration |
| 9 | +This release includes the complete migration from Python dataclasses to Pydantic v2 models across the entire codebase (from v0.7.0). All models now use Pydantic for validation, serialization, and data handling. |
| 10 | + |
| 11 | +**Key Benefits:** |
| 12 | +- Automatic data validation with clear error messages |
| 13 | +- Built-in serialization with `model_dump()` and `model_dump_json()` |
| 14 | +- Pythonic `snake_case` field names while maintaining API `camelCase` compatibility |
| 15 | +- Better type safety and IDE support |
| 16 | + |
| 17 | +### Removed Mock Tests |
| 18 | +All mock tests and associated JSON fixtures have been removed (22,370+ lines). The test suite now focuses exclusively on external tests that validate against the actual MLB Stats API. |
| 19 | + |
| 20 | +## 📝 Breaking Changes |
| 21 | + |
| 22 | +⚠️ **This is a major version release with breaking changes:** |
| 23 | + |
| 24 | +1. **Field Access**: All model fields now use `snake_case` instead of `camelCase`: |
| 25 | + ```python |
| 26 | + # Before |
| 27 | + game.gamedata.weather |
| 28 | + |
| 29 | + # After |
| 30 | + game.game_data.weather |
| 31 | + ``` |
| 32 | + |
| 33 | +2. **Validation Errors**: Invalid data now raises `pydantic.ValidationError` instead of `TypeError` |
| 34 | + |
| 35 | +3. **Serialization**: Use Pydantic methods for serialization: |
| 36 | + ```python |
| 37 | + # New methods |
| 38 | + model.model_dump() |
| 39 | + model.model_dump_json() |
| 40 | + ``` |
| 41 | + |
| 42 | +## 🔧 Model Updates |
| 43 | + |
| 44 | +### Core Models |
| 45 | +- All models migrated to Pydantic `MLBBaseModel` |
| 46 | +- Field aliases updated to match actual API `camelCase` format |
| 47 | +- Optional fields properly marked for fields that may be missing |
| 48 | + |
| 49 | +### Specific Model Fixes |
| 50 | +- **Game Models**: `gamePk`, `gameData`, `liveData`, `metaData` aliases corrected |
| 51 | +- **HomeRunDerby**: `homeRun`, `tieBreaker`, `isHomeRun`, `isTieBreaker` aliases fixed |
| 52 | +- **Stats Models**: `wobaCon`, `pitchArsenal` aliases corrected |
| 53 | +- **Schedule Models**: `calendarEventId` made optional |
| 54 | +- **Standings Models**: `wildcardGamesBack`, `wildcardEliminationNumber` made optional |
| 55 | + |
| 56 | +## 🐛 Bug Fixes |
| 57 | + |
| 58 | +- Fixed missing fields in various stat models |
| 59 | +- Added `age` and `caughtstealingpercentage` to `SimplePitchingSplit` |
| 60 | +- Fixed `flyballpercentage` field in `AdvancedPitchingSplit` |
| 61 | +- Updated models for new MLB API fields |
| 62 | +- Fixed missing keys in live feed data |
| 63 | + |
| 64 | +## 📚 Documentation |
| 65 | + |
| 66 | +- Updated README with Pydantic migration examples |
| 67 | +- Added "Working with Pydantic Models" section |
| 68 | +- Added Contributing section to README |
| 69 | +- Updated all code examples to use `snake_case` field names |
| 70 | + |
| 71 | +## 🔄 Migration Guide |
| 72 | + |
| 73 | +If you're upgrading from v0.5.x or v0.6.x: |
| 74 | + |
| 75 | +1. **Update field access**: Change all `camelCase` field names to `snake_case` |
| 76 | + ```python |
| 77 | + # Old |
| 78 | + game.gamedata.weather |
| 79 | + stat.totalsplits |
| 80 | + |
| 81 | + # New |
| 82 | + game.game_data.weather |
| 83 | + stat.total_splits |
| 84 | + ``` |
| 85 | + |
| 86 | +2. **Update error handling**: Catch `ValidationError` instead of `TypeError` |
| 87 | + ```python |
| 88 | + from pydantic import ValidationError |
| 89 | + |
| 90 | + try: |
| 91 | + game = Game(**data) |
| 92 | + except ValidationError as e: |
| 93 | + # Handle validation error |
| 94 | + ``` |
| 95 | + |
| 96 | +3. **Use Pydantic serialization**: Replace `__dict__` access with `model_dump()` |
| 97 | + ```python |
| 98 | + # Old |
| 99 | + data = game.__dict__ |
| 100 | + |
| 101 | + # New |
| 102 | + data = game.model_dump() |
| 103 | + ``` |
| 104 | + |
| 105 | +## 📦 Dependencies |
| 106 | + |
| 107 | +- Added `pydantic>=2.0` as a core dependency |
| 108 | +- Migrated from setuptools to Poetry for dependency management |
| 109 | + |
| 110 | +## 🧪 Testing |
| 111 | + |
| 112 | +- Removed all mock tests (22,370+ lines) |
| 113 | +- External tests updated and passing |
| 114 | +- CI/CD pipelines updated to remove mock test runs |
| 115 | + |
| 116 | +## 🙏 Contributors |
| 117 | + |
| 118 | +Thank you to all contributors who helped with this major release! |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +**Full Changelog**: See commit history from v0.5.3 to HEAD |
0 commit comments