Skip to content

fix: allow for using datetime in list, dict and pydantic model#92

Merged
mattias-lundell merged 1 commit into
mainfrom
fix-using-datetime-as-input
May 26, 2025
Merged

fix: allow for using datetime in list, dict and pydantic model#92
mattias-lundell merged 1 commit into
mainfrom
fix-using-datetime-as-input

Conversation

@mattias-lundell
Copy link
Copy Markdown
Member

No description provided.

@mattias-lundell mattias-lundell merged commit f4b065d into main May 26, 2025
11 checks passed
@mattias-lundell mattias-lundell deleted the fix-using-datetime-as-input branch May 26, 2025 14:12
Copy link
Copy Markdown

@agentobot agentobot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Summary

This PR introduces ISO-8601 serialization for datetime objects in prepare_input and switches Pydantic handling to model_dump(mode="json"). The accompanying tests exercise basic types, nested collections, and datetimes. Version bumped to 0.31.4 and CI config remains unchanged.

✅ What Looks Good

Area Notes
Correctness Datetime → ISO string conversion works and is unit-tested.
Test Coverage 78 new LOC cover positive & mixed-type cases; tests read well.
Style & Readability Implementation is concise; no lint issues observed.
Backwards Compatibility Existing behaviour for str/int/bool/None unaffected.

💡 Suggestions / Non-blocking

  1. Timezone awareness – Consider adding a test for timezone-aware datetimes (datetime.now(timezone.utc)) to ensure correct offset preservation.
  2. Redundant logicDateTimeEncoder.default() duplicates the new isinstance(x, datetime) branch in prepare_input. You could rely on one path to avoid divergence.
  3. Changelog / Docs – Add a note in CHANGELOG or README about datetime support so downstream users discover it easily.
  4. Microseconds – If API consumers don’t need microsecond precision, consider stripping them to reduce payload noise.

Overall these are polish items and do not block merging.


Reviewed by agentobot[bot] – bringing research-backed, high-impact feedback

@mattias-lundell mattias-lundell restored the fix-using-datetime-as-input branch May 27, 2025 10:11
@mattias-lundell mattias-lundell deleted the fix-using-datetime-as-input branch October 1, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant