Fix datetime object handling in OpenAPI schema generation
Description
This PR fixes #1124
Summary
This PR fixes the OpenAPI schema generation for endpoints that return datetime objects. Previously, the application would fail to start with an AttributeError when attempting to generate OpenAPI documentation for endpoints returning datetime.datetime or datetime.date objects.
Changes made:
- Added special handling for
datetime.datetimeanddatetime.datetypes in schema generation - Added proper OpenAPI schema type ("string") and format ("date-time"/"date") for datetime objects
- Added unit tests for datetime schema generation
PR Checklist
Please ensure that:
- [x] The PR contains a descriptive title
- [x] The PR contains a descriptive summary of the changes
- [x] You build and test your changes before submitting a PR.
- [x] You have added relevant documentation
- [x] You have added relevant tests. We prefer integration tests wherever possible
Pre-Commit Instructions:
- [x] Ensure that you have run the pre-commit hooks on your PR.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| robyn | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Mar 5, 2025 4:54pm |
Hey @Soroushsrd 👋
One more thing
Lint PR / lint (pull_request)Failing after 1m
Lint PR is failing as well
Thank you for the comments. Will fix it ASAP
Hi @Soroushsrd, some of the test for python 3.9 and 3.10 failing, can you fix them?
😱 Found 1 issue. Time to roll up your sleeves! 😱