Skip to content
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

fix: keep old behaviour of json() by default #3542

Merged
merged 3 commits into from Dec 24, 2021

Conversation

PrettyWood
Copy link
Member

@PrettyWood PrettyWood commented Dec 19, 2021

Change Summary

fix regression on 1.9 introduced in #2650 (see #3538 (reply in thread))

Related issue number

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.md file added describing change (I didn't add a change file since it's due to a new feature of 1.9)
    (see changes/README.md for details)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@PrettyWood
Copy link
Member Author

please review

@layday
Copy link
Contributor

layday commented Dec 19, 2021

I'm not sure if this is a good workaround. IIUC the (broader) issue with #2650 is that the transformation is no longer recursive. This will manifest in other ways (and it already has: #3544 :) It'd probably make more sense to expose to_dict in json, but adding more options always comes at a cost.

@layday
Copy link
Contributor

layday commented Dec 19, 2021

If you don't want to delay v1.9 then reverting #2650 might be the best course of action for the time being?

@PrettyWood
Copy link
Member Author

Yeah I saw new issues pop up. I will take some time tomorrow to check properly. But if no easy workaround is possible, I'll revert #2650

@PrettyWood PrettyWood changed the title fix: handle basemodel fallback for custom encoders fix: keep old behaviour of json() by default Dec 20, 2021
@PrettyWood PrettyWood added the bug V1 Bug related to Pydantic V1.X label Dec 20, 2021
pydantic/main.py Outdated Show resolved Hide resolved
Co-authored-by: Christian Bundy <christianbundy@fraction.io>
@samuelcolvin
Copy link
Member

@PrettyWood did you have time to think about this?

I've haven't dug into it in detail, but I will try to find time soon.

@christianbundy
Copy link
Contributor

FWIW after the force-push this seems to solve the problem (and adds a test from #3544). At least from my perspective, this looks Fine™️.

@PrettyWood
Copy link
Member Author

This should solve everything yes

@samuelcolvin samuelcolvin merged commit edad0db into pydantic:master Dec 24, 2021
@samuelcolvin
Copy link
Member

awesome, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V1 Bug related to Pydantic V1.X ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants