Robyn icon indicating copy to clipboard operation
Robyn copied to clipboard

Fix datetime object handling in OpenAPI schema generation

Open Soroushsrd opened this issue 9 months ago • 5 comments

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.datetime and datetime.date types 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:

Soroushsrd avatar Mar 05 '25 16:03 Soroushsrd

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

vercel[bot] avatar Mar 05 '25 16:03 vercel[bot]

Hey @Soroushsrd 👋

One more thing

Lint PR / lint (pull_request)Failing after 1m

Lint PR is failing as well

sansyrox avatar Mar 06 '25 20:03 sansyrox

Thank you for the comments. Will fix it ASAP

Soroushsrd avatar Mar 06 '25 20:03 Soroushsrd

Hi @Soroushsrd, some of the test for python 3.9 and 3.10 failing, can you fix them?

tavallaie avatar Mar 07 '25 12:03 tavallaie

😱 Found 1 issue. Time to roll up your sleeves! 😱

recurseml[bot] avatar May 27 '25 19:05 recurseml[bot]