Open mpeyfuss opened 6 months ago
It could be easy enough to just the annotation to the TYPES list in fields but the tricky bit is mimicking Django validator behavior. Django's default behavior is debatable too though, as it will accept FTP URLs and IPs which many people might not want.
Maybe the more complete solution is to be able to declare a Pydantic type annotation on a custom Django Field, then it could get reused automatically everywhere. It would also provide a path for third-party libraries that implement their own fields to improve their out-of-box support with Ninja.
Describe the bug When using a
URLField
in a Django model and then using aModelSchema
for serialization/validation on aPOST
request, the url is just validated as astr
. Most other fields are covered in Ninja, but this one seems to be missing.Versions (please complete the following information):