mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 10:31:50 +01:00
## ℹ️ Description - Link to the related issue(s): Issue # - Fixes drift where `pdm run app download` wrote timestamp values in YAML-native datetime form that could violate `schemas/ad.schema.json` string expectations. - Ensures downloaded ads persist `created_on`/`updated_on` as JSON-serialized ISO-8601 strings and adds a regression test validating written YAML against the schema. ## 📋 Changes Summary - Updated downloader save path to use `ad_cfg.model_dump(mode = \"json\")` before writing YAML in `src/kleinanzeigen_bot/extract.py`. - Updated existing `download_ad` unit assertion to match JSON-mode serialization. - Added `test_download_ad_writes_schema_compliant_yaml` in `tests/unit/test_extract.py` that writes a real tmp YAML file and validates it against `schemas/ad.schema.json` with `jsonschema`. - Added dev dependency `jsonschema>=4.26.0` (and lockfile updates). - Dependencies/config updates introduced: new dev dependency (`jsonschema`) for full schema validation in tests. ### ⚙️ Type of Change - [x] 🐞 Bug fix (non-breaking change which fixes an issue) - [ ] ✨ New feature (adds new functionality without breaking existing usage) - [ ] 💥 Breaking change (changes that might break existing user setups, scripts, or configurations) ## ✅ Checklist - [x] I have reviewed my changes to ensure they meet the project's standards. - [x] I have tested my changes and ensured that all tests pass (`pdm run test`). - [x] I have formatted the code (`pdm run format`). - [x] I have verified that linting passes (`pdm run lint`). - [x] I have updated documentation where necessary. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit # Release Notes * **Bug Fixes** * Improved ad data serialization to ensure consistent JSON format when saving ad configurations. * **Tests** * Added schema validation tests to verify ad YAML output compliance. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
76 KiB
76 KiB