Title: Pydantic Validators does not raise ValueError if conditions are not met · Issue #134 · fastapi/sqlmodel · GitHub
Open Graph Title: Pydantic Validators does not raise ValueError if conditions are not met · Issue #134 · fastapi/sqlmodel
X Title: Pydantic Validators does not raise ValueError if conditions are not met · Issue #134 · fastapi/sqlmodel
Description: First Check I added a very descriptive title to this issue. I used the GitHub search to find a similar issue and didn't find it. I searched the SQLModel documentation, with the integrated search. I already searched in Google "How to X in...
Open Graph Description: First Check I added a very descriptive title to this issue. I used the GitHub search to find a similar issue and didn't find it. I searched the SQLModel documentation, with the integrated search. I...
X Description: First Check I added a very descriptive title to this issue. I used the GitHub search to find a similar issue and didn't find it. I searched the SQLModel documentation, with the integrated searc...
Opengraph URL: https://github.com/fastapi/sqlmodel/issues/134
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Pydantic Validators does not raise ValueError if conditions are not met","articleBody":"### First Check\n\n- [X] I added a very descriptive title to this issue.\n- [X] I used the GitHub search to find a similar issue and didn't find it.\n- [X] I searched the SQLModel documentation, with the integrated search.\n- [X] I already searched in Google \"How to X in SQLModel\" and didn't find any information.\n- [ ] I already read and followed all the tutorial in the docs and didn't find an answer.\n- [X] I already checked if it is not related to SQLModel but to [Pydantic](https://github.com/samuelcolvin/pydantic).\n- [X] I already checked if it is not related to SQLModel but to [SQLAlchemy](https://github.com/sqlalchemy/sqlalchemy).\n\n### Commit to Help\n\n- [X] I commit to help with one of those options 👆\n\n### Example Code\n\n```python\nclass Playlist(SQLModel, table=True):\r\n __tablename__ = 'playlists'\r\n\r\n id: Optional[int] = Field(default=None, primary_key=True)\r\n title: str\r\n description: Optional[str]\r\n \r\n\r\n @validator('title')\r\n def title_not_too_long(cls, v):\r\n if len(v) > 255:\r\n raise ValueError('too long')\r\n return v\r\n\r\n\r\n\r\np = Playlist(title=\"x\" * 300, description=\"OK\")\r\np.title # None\r\np.description # 'OK'\n```\n\n\n### Description\n\nWhen the condition is not met, the code just returns None for the field instead of raising an error. \r\n\r\nThe other fields are well populated.\n\n### Operating System\n\nWindows\n\n### Operating System Details\n\n_No response_\n\n### SQLModel Version\n\n0.0.4\n\n### Python Version\n\n3.9.2\n\n### Additional Context\n\n_No response_","author":{"url":"https://github.com/sorasful","@type":"Person","name":"sorasful"},"datePublished":"2021-10-16T19:14:58Z","url":"https://github.com/fastapi/sqlmodel/issues/134"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:970886bc-360e-9932-c6b3-4872f9421789 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ECD4:23C8C5:647495:8EFC3F:6AFDF273 |
| html-safe-nonce | ad879e19904936125e9d333ab64ac5b5c006113c289d0f1598ef7543cfcd0f90 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQ0Q0OjIzQzhDNTo2NDc0OTU6OEVGQzNGOjZBRkRGMjczIiwidmlzaXRvcl9pZCI6IjI3NzE5OTY1NzM1MTU1MTAzODciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 63cc16444a7bec090b555470f5e0997a0764450e53ee05f7e1142df9af04e3aa |
| hovercard-subject-tag | issue:1028126932 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/fastapi/sqlmodel/134/issue_layout |
| twitter:image | https://opengraph.githubassets.com/04ef3ddce5e9d997ed3e1be48ccc54c1f2287cbc4a1c143d6aec5f66daa5a915/fastapi/sqlmodel/issues/134 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/04ef3ddce5e9d997ed3e1be48ccc54c1f2287cbc4a1c143d6aec5f66daa5a915/fastapi/sqlmodel/issues/134 |
| og:image:alt | First Check I added a very descriptive title to this issue. I used the GitHub search to find a similar issue and didn't find it. I searched the SQLModel documentation, with the integrated search. I... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sorasful |
| hostname | github.com |
| expected-hostname | github.com |
| None | dd812ec581ecac95855f5ec917ef9827506c39a9da1443f43ddb4179a46471eb |
| turbo-cache-control | no-preview |
| go-import | github.com/fastapi/sqlmodel git https://github.com/fastapi/sqlmodel.git |
| octolytics-dimension-user_id | 156354296 |
| octolytics-dimension-user_login | fastapi |
| octolytics-dimension-repository_id | 399495186 |
| octolytics-dimension-repository_nwo | fastapi/sqlmodel |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 399495186 |
| octolytics-dimension-repository_network_root_nwo | fastapi/sqlmodel |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 32ac708bac264dafdc28e10ff49b4d137f0c34a7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width