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
Empty string is a valid JSON-key #4252
Empty string is a valid JSON-key #4252
Conversation
Signed-off-by: Sergey Tsaplin <me@sergeytsaplin.com>
04a0fc7
to
c82d286
Compare
Thanks for the contribution. While I think you're technically correct. I'm not sure I would support changing this at this late stage for pydantic V1. I believe this is fixed in pydantic-core (the basis for pydantic V2) - if you're willing, it would be very useful to add unit tests for this to pydantic-core? The plan is to get v1.10 released with mostly cosmetic changes and some new features that having been hanging around for a long time, then move ahead with V2. What do others think? @PrettyWood @hramezani |
Thanks @SergeyTsaplin for the patch 👍 and Thanks @samuelcolvin for explaining and asking my opinion.
Why would be the problem? seems we don't need a big change to support it?
👍 |
ye, I agree it's a small change. Just there's a lot in Let's wait and see what @PrettyWood thinks. |
@samuelcolvin I don't think that the change will break some existed code, it can break only when a user uses About the unit-test to pydantic-core - I can do it, but not soon. It may take me a few days to find a time for it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise LGTM
Let's go ahead with this.
No problem with a wait, this is a marathon, not a sprint. |
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
…arison with None Signed-off-by: Sergey Tsaplin <me@sergeytsaplin.com>
By the way, I found one more place where I missed the correct condition. Should I squash all the commits to a single one? |
no, just keep committing, we squash on merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I don't see any risk for this in v1.10
So, I believe it's absolutely ready, so please review. |
Let's wait for @samuelcolvin for final review and probably merge. |
thanks so much. |
Well (while I still think this is okay to be included in v1.10), my paranoia was well placed, tis was breaking starlite, see litestar-org/litestar#402. Basically with pydantic v1's massive public (or semi-public) API, basically every change can break something. Bring on V2. |
Change Summary
An empty string is a valid JSON attribute name, so aliases checking cannot be just like
bool(alias)
it should be strictly compared withNone
.Related issue number
fix #4253
Checklist
changes/<pull request or issue id>-<github username>.md
file added describing change(see changes/README.md for details)