Open Malakarakesh1993 opened 6 months ago
Hi,
But trying to access api/v1/schema throws Object of type 'str' is not JSON serializable error and the str references to migration files upon searching in the codebase.
where does it say "str" is not serializable
? because your error message looks very much like a timezone
object.
It appears that somehow a timezone object found its way into the schema.
The JSON serializer is the same as DRF, so it serializes everything that DRF is able to.
It agree that this is likely due the the custom timezone field: https://github.com/mfogel/django-timezone-field/blob/4207dc0210d0771a3d2d3193a50a4ac59f38c12a/timezone_field/rest_framework.py#L8C7-L8C30
You may need to write a field extension for it and convert that timezone object to a actual str:
Getting serializer error when accessing default api schema view.
Here's the url definition:
And the rest is just the default library class-based views.
But trying to access
api/v1/schema
throwsObject of type 'str' is not JSON serializable
error and the str references to migration files upon searching in the codebase.Here's the field that might be the cause:
And here's what I managed to get from traceback:
Any idea on how can I resolve this issue?