René's URL Explorer Experiment


Title: Raise ValidationError for invalid values in Django vector fields by mayuriphad · Pull Request #172 · pgvector/pgvector-python · GitHub

Open Graph Title: Raise ValidationError for invalid values in Django vector fields by mayuriphad · Pull Request #172 · pgvector/pgvector-python

X Title: Raise ValidationError for invalid values in Django vector fields by mayuriphad · Pull Request #172 · pgvector/pgvector-python

Description: Fixes #171 VectorField, HalfVectorField and SparseVectorField pass form and serializer input straight to the text parsers. A malformed value made form.is_valid() raise ValueError, and a value with the wrong number of dimensions passed validation and only failed on save() with a DataError from Postgres. In both cases the request ended in a 500. Changes: to_python turns parse errors into ValidationError (Enter a valid vector. and the half/sparse variants). Each field adds a validator, the way max_length adds MaxLengthValidator. It checks that the value converts to the vector type and, when dimensions is set, that the length matches (Expected 3 dimensions, not 2.). Since it is in validators, DRF's ModelField also runs it, and ArrayField(VectorField(dimensions=3)) reports the bad item. Valid input behaves as before. Fields without dimensions skip the length check. Tests: new cases in tests/test_django.py for full_clean and the three model forms, covering malformed input and wrong dimensions. The full suite, mypy and ty check pass on my fork's CI run (Postgres with pgvector 0.8.7).

Open Graph Description: Fixes #171 VectorField, HalfVectorField and SparseVectorField pass form and serializer input straight to the text parsers. A malformed value made form.is_valid() raise ValueError, and a value with ...

X Description: Fixes #171 VectorField, HalfVectorField and SparseVectorField pass form and serializer input straight to the text parsers. A malformed value made form.is_valid() raise ValueError, and a value with ...

Opengraph URL: https://github.com/pgvector/pgvector-python/pull/172

X: @github

direct link

Domain: redirect.github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:9e83ce87-8b54-73fc-1713-3a0d64973345
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDB5C:11F29A:CA8CED:109076E:6AFE8A2C
html-safe-noncee03b1b943de2ba7f9bb7c6399932efc8d27ffbe1f3d1444d1ea72e7ffd2e9689
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjVDOjExRjI5QTpDQThDRUQ6MTA5MDc2RTo2QUZFOEEyQyIsInZpc2l0b3JfaWQiOiIyODg2ODkzNjUzMTI3NDk4Mjg1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac0f9b668e8a7986ca2ff350e7132eb8e875fa6f0a7f896d6d1b99447b4ab53661
hovercard-subject-tagpull_request:5002127228
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/pgvector/pgvector-python/pull/172/files
twitter:imagehttps://avatars.githubusercontent.com/u/163738104?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/163738104?s=400&v=4
og:image:altFixes #171 VectorField, HalfVectorField and SparseVectorField pass form and serializer input straight to the text parsers. A malformed value made form.is_valid() raise ValueError, and a value with ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/pgvector/pgvector-python git https://github.com/pgvector/pgvector-python.git
octolytics-dimension-user_id98363230
octolytics-dimension-user_loginpgvector
octolytics-dimension-repository_id376300726
octolytics-dimension-repository_nwopgvector/pgvector-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id376300726
octolytics-dimension-repository_network_root_nwopgvector/pgvector-python
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4a10310af51a1bfffbedc4fd81cb582acf0cb0ff
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://redirect.github.com/pgvector/pgvector-python/pull/172/files#start-of-content
https://redirect.github.com/
Sign inhttps://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpgvector%2Fpgvector-python%2Fpull%2F172%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpgvector%2Fpgvector-python%2Fpull%2F172%2Ffiles
Sign uphttps://redirect.github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=pgvector%2Fpgvector-python
Reloadhttps://redirect.github.com/pgvector/pgvector-python/pull/172/files
Reloadhttps://redirect.github.com/pgvector/pgvector-python/pull/172/files
Reloadhttps://redirect.github.com/pgvector/pgvector-python/pull/172/files
pgvectorhttps://redirect.github.com/pgvector
pgvector-pythonhttps://redirect.github.com/pgvector/pgvector-python
Codehttps://redirect.github.com/pgvector/pgvector-python
Issues2 (2)https://redirect.github.com/pgvector/pgvector-python/issues
Pull requests8 (8)https://redirect.github.com/pgvector/pgvector-python/pulls
Actionshttps://redirect.github.com/pgvector/pgvector-python/actions
Security and qualityhttps://redirect.github.com/pgvector/pgvector-python/security
Insightshttps://redirect.github.com/pgvector/pgvector-python/insights
Sign up for GitHub https://redirect.github.com/signup?return_to=%2Fpgvector%2Fpgvector-python%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://redirect.github.com/login?return_to=%2Fpgvector%2Fpgvector-python%2Fissues%2Fnew%2Fchoose
mayuriphadhttps://redirect.github.com/mayuriphad
pgvector:masterhttps://redirect.github.com/pgvector/pgvector-python/tree/master
mayuriphad:django-validation-errorshttps://redirect.github.com/mayuriphad/pgvector-python/tree/django-validation-errors
Conversation 1 https://redirect.github.com/pgvector/pgvector-python/pull/172
Commits 2 https://redirect.github.com/pgvector/pgvector-python/pull/172/commits
Checks 0 https://redirect.github.com/pgvector/pgvector-python/pull/172/checks
Files changed https://redirect.github.com/pgvector/pgvector-python/pull/172/files
Please reload this pagehttps://redirect.github.com/pgvector/pgvector-python/pull/172/files
Raise ValidationError for invalid values in Django vector fields https://redirect.github.com/pgvector/pgvector-python/pull/172/files#top
Show all changes 2 commits https://redirect.github.com/pgvector/pgvector-python/pull/172/files
f5b4b8b Raise ValidationError for invalid vectors in Django fields mayuriphad Oct 25, 2026 https://redirect.github.com/pgvector/pgvector-python/pull/172/commits/f5b4b8bab808a1181ba1c45b22d263b17f09eb6b
271e966 Check the parsed vector for None instead of ignoring the type mayuriphad Oct 25, 2026 https://redirect.github.com/pgvector/pgvector-python/pull/172/commits/271e966878acd4b76690d3d2d27b12811629c92b
Clear filters https://redirect.github.com/pgvector/pgvector-python/pull/172/files
Please reload this pagehttps://redirect.github.com/pgvector/pgvector-python/pull/172/files
Please reload this pagehttps://redirect.github.com/pgvector/pgvector-python/pull/172/files
CHANGELOG.md https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
halfvec.py https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-32b1ad838c7725212f402409f26dce6093a7bd85ede7cee7c53cbc4beecfc64f
sparsevec.py https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-31436cbc6c50c993027461be5627277da89b4b3e1958fac05c2b2361d1377259
vector.py https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-f603afe1ca5b9de9d3bfdced49ae71738b60e4fcb3d0a6b1c8900cb81e74c699
test_django.py https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-930917b71eb0da934428d418379a43488873ea091eb29b1ea0450b242653d9e5
CHANGELOG.mdhttps://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
View file https://redirect.github.com/pgvector/pgvector-python/blob/271e966878acd4b76690d3d2d27b12811629c92b/CHANGELOG.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://redirect.github.com/pgvector/pgvector-python/pull/172/{{ revealButtonHref }}
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
pgvector/django/halfvec.pyhttps://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-32b1ad838c7725212f402409f26dce6093a7bd85ede7cee7c53cbc4beecfc64f
View file https://redirect.github.com/pgvector/pgvector-python/blob/271e966878acd4b76690d3d2d27b12811629c92b/pgvector/django/halfvec.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://redirect.github.com/pgvector/pgvector-python/pull/172/{{ revealButtonHref }}
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-32b1ad838c7725212f402409f26dce6093a7bd85ede7cee7c53cbc4beecfc64f
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-32b1ad838c7725212f402409f26dce6093a7bd85ede7cee7c53cbc4beecfc64f
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-32b1ad838c7725212f402409f26dce6093a7bd85ede7cee7c53cbc4beecfc64f
pgvector/django/sparsevec.pyhttps://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-31436cbc6c50c993027461be5627277da89b4b3e1958fac05c2b2361d1377259
View file https://redirect.github.com/pgvector/pgvector-python/blob/271e966878acd4b76690d3d2d27b12811629c92b/pgvector/django/sparsevec.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://redirect.github.com/pgvector/pgvector-python/pull/172/{{ revealButtonHref }}
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-31436cbc6c50c993027461be5627277da89b4b3e1958fac05c2b2361d1377259
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-31436cbc6c50c993027461be5627277da89b4b3e1958fac05c2b2361d1377259
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-31436cbc6c50c993027461be5627277da89b4b3e1958fac05c2b2361d1377259
pgvector/django/vector.pyhttps://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-f603afe1ca5b9de9d3bfdced49ae71738b60e4fcb3d0a6b1c8900cb81e74c699
View file https://redirect.github.com/pgvector/pgvector-python/blob/271e966878acd4b76690d3d2d27b12811629c92b/pgvector/django/vector.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://redirect.github.com/pgvector/pgvector-python/pull/172/{{ revealButtonHref }}
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-f603afe1ca5b9de9d3bfdced49ae71738b60e4fcb3d0a6b1c8900cb81e74c699
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-f603afe1ca5b9de9d3bfdced49ae71738b60e4fcb3d0a6b1c8900cb81e74c699
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-f603afe1ca5b9de9d3bfdced49ae71738b60e4fcb3d0a6b1c8900cb81e74c699
tests/test_django.pyhttps://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-930917b71eb0da934428d418379a43488873ea091eb29b1ea0450b242653d9e5
View file https://redirect.github.com/pgvector/pgvector-python/blob/271e966878acd4b76690d3d2d27b12811629c92b/tests/test_django.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://redirect.github.com/pgvector/pgvector-python/pull/172/{{ revealButtonHref }}
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-930917b71eb0da934428d418379a43488873ea091eb29b1ea0450b242653d9e5
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-930917b71eb0da934428d418379a43488873ea091eb29b1ea0450b242653d9e5
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-930917b71eb0da934428d418379a43488873ea091eb29b1ea0450b242653d9e5
https://redirect.github.com/pgvector/pgvector-python/pull/172/files#diff-930917b71eb0da934428d418379a43488873ea091eb29b1ea0450b242653d9e5
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.