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
Field(nullable=True)
is ignored due to recent changes released in version 0.0.7
#420
Comments
This comment was marked as outdated.
This comment was marked as outdated.
I've submitted a new test that tests nullable fields, and it seems correct to me. |
Aha, I understand now. Seems like a weird pattern to set a default value, but not allow it.. To me it seems like you just shouldn't type it as optional. As a side note, please either branch out from the PR / ask for branch permissions to add more commits / add the original author as a co-author when you copy/paste code from another PR 😊 You've copied everything I wrote, but I am not listed as a contributor. 😉 |
You might type is as optional so that you can create the object without setting all the fields. Happy to do either. If you give me branch permissions, I can make my change to your existing branch.
|
Added you as a co-author: 00cebd2 |
Gave you access to mine, but up to you. I assume you have to rebase those commits into one commit to get it merged anyway 😄 |
Since you added me as a co-author on the wrong commit, I honestly think you should just finish your PR, copy over the changes you'd like into my PR, and then close yours. Then git history will be correct, and git commit history could be two commits with the correct authors. |
`Field` are inserting into the database as nullable. This was introduced in tiangolo@9830ee0#r82434170 and described in tiangolo#420. Example: ``` required_field: Optional[str] = Field(nullable=False) ``` - Added a test to confirm the regression - Fixed test by re-ordering the code that determines if a field is nullable. Co-authored-by: Jonas Krüger Svensson <jonas-ks@hotmail.com>, building off his PR: tiangolo#423 add coverage reports run code coverage Add more checks to the test for the regression. Co-authored-by: Jonas Krüger Svensson <jonas-ks@hotmail.com> Fix comment on test Co-authored-by: Jonas Krüger Svensson <jonas-ks@hotmail.com> Formatting, comments Co-authored-by: Jonas Krüger Svensson <jonas-ks@hotmail.com> Remove newline Co-authored-by: Jonas Krüger Svensson jonas-ks@hotmail.com remove comment simplify test rename variable add missing assert
I assumed @tiangolo would squash the commits before merging the PR. But I will commit to your PR. |
Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs. |
First Check
Commit to Help
Example Code
Description
Field(nullable=True)
I believe this issue was introduced here: 9830ee0#r82434170
Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.7
Python Version
Python 3.10.5
Additional Context
No response
The text was updated successfully, but these errors were encountered: