You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, so I had a use case where I needed to represent an event that reoccurred every X time for the duration of Y time, and I wanted to represent this event in my FastAPI + Pydantic stack. [https://stackoverflow.com/questions/77705081/time-intervals-in-python](This is the full use case). I concluded that implementing this on my own would require a lot of validation and parsing. I found out there is already a standard for it : RFC 5545 - ICalender, which as far as I know, the rrule part of it is implemented in [https://dateutil.readthedocs.io/en/stable/rrule.html](dateuttil package) However, while it is supported in many JS calendars, I couldn't find support for it, especially for rrule, as a "first citizen" Pydantic type. I will admit I am not very knowledgeable about how Pydantic is implemented, however, an rrule can't generate a pydantic-core schema (i.e the error: pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <module 'dateutil.rrule' from '<...>/dateutil/rrule.py'>. Set arbitrary_types_allowed=Truein the model_config to ignore this error or implementget_pydantic_core_schema on your type to fully support it.
And therefore I can't use it in my swagger and API.
I know the dateutil package it third-party, and most of the types supported by Pydantic are not, however, since this is the calendering standard, I do think Pydantic support would be helpful here.
Hi, so I had a use case where I needed to represent an event that reoccurred every X time for the duration of Y time, and I wanted to represent this event in my FastAPI + Pydantic stack. [https://stackoverflow.com/questions/77705081/time-intervals-in-python](This is the full use case). I concluded that implementing this on my own would require a lot of validation and parsing. I found out there is already a standard for it : RFC 5545 - ICalender, which as far as I know, the rrule part of it is implemented in [https://dateutil.readthedocs.io/en/stable/rrule.html](dateuttil package) However, while it is supported in many JS calendars, I couldn't find support for it, especially for rrule, as a "first citizen" Pydantic type. I will admit I am not very knowledgeable about how Pydantic is implemented, however, an rrule can't generate a pydantic-core schema (i.e the error:
pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <module 'dateutil.rrule' from '<...>/dateutil/rrule.py'>. Set
arbitrary_types_allowed=Truein the model_config to ignore this error or implement
get_pydantic_core_schemaon your type to fully support it.
And therefore I can't use it in my swagger and API.
I know the dateutil package it third-party, and most of the types supported by Pydantic are not, however, since this is the calendering standard, I do think Pydantic support would be helpful here.
Original issue: pydantic/pydantic#8451
The text was updated successfully, but these errors were encountered: