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 an issue where JSON schema extras weren't JSON encoded #7625

Merged
merged 2 commits into from Sep 26, 2023

Conversation

dmontagu
Copy link
Contributor

Closes tiangolo/fastapi#10321

As far as I can tell, in v1, we would json encode anything extra (which included the examples). So I think this is restoring intended behavior (and as far as I can imagine is objectively better behavior in all circumstances where it might affect things).

@Kludex for reference

@cloudflare-pages
Copy link

cloudflare-pages bot commented Sep 26, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: b6c62e3
Status: ✅  Deploy successful!
Preview URL: https://7508f175.pydantic-docs2.pages.dev
Branch Preview URL: https://dmontagu-fix-unencoded-json.pydantic-docs2.pages.dev

View logs

@dmontagu
Copy link
Contributor Author

Note this doesn't affect the result of a mutating json_schema_extra. To make that work would be a bit more complex because it makes in-place changes, so a straightforward call to to_jsonable_python won't work out of the box as that won't mutate the input. But it could be made to work, I'm just not sure it's worth the overhead it would add.

@dmontagu dmontagu added the relnotes-fix Used for bugfixes. label Sep 26, 2023
@dmontagu dmontagu merged commit b403666 into main Sep 26, 2023
60 of 61 checks passed
@dmontagu dmontagu deleted the dmontagu/fix-unencoded-json-schema branch September 26, 2023 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes-fix Used for bugfixes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pydantic 2 Regression: Openapi error when "examples" contains models
2 participants