AnyURL pydantic types are not json serializable, so urls are validated as str.
I've tried defining a custom json_encoder, but the pydantic type is not actually an AnyURL object, so I was not able to detect the right class.
A solution to this would properly leverage pydantic's url validation, but also allow for a successful json.dumps(<model>.dict()) of a class with a URI field.
AnyURL pydantic types are not json serializable, so urls are validated as
str
.I've tried defining a custom json_encoder, but the pydantic type is not actually an
AnyURL
object, so I was not able to detect the right class.A solution to this would properly leverage pydantic's url validation, but also allow for a successful
json.dumps(<model>.dict())
of a class with a URI field.