New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] models.URLField
serialized & validated as str
#1157
Comments
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):
The text was updated successfully, but these errors were encountered: