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

Update warnings parameter for serialization utilities to allow raising a warning #9166

Conversation

Lance-Drane
Copy link
Contributor

@Lance-Drane Lance-Drane commented Apr 4, 2024

Change Summary

This MR updates the type annotations and documentation for the warnings parameter of BaseModel.model_dump(), BaseModel.model_dump_json(), TypeAdapter.dump_python(), and TypeAdapter.dump_json(). The implementation logic was captured entirely in pydantic/pydantic-core#1258 , which has already been merged.

Note that the Pyright test will fail until the pydantic-core version is bumped.

Related issue number

#8978

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer: @samuelcolvin

@Lance-Drane
Copy link
Contributor Author

please review

Copy link

codspeed-hq bot commented Apr 4, 2024

CodSpeed Performance Report

Merging #9166 will not alter performance

Comparing Lance-Drane:8978_serialization_error_if_pydantic_core_mismatch (bdfafda) with main (a01b902)

Summary

✅ 13 untouched benchmarks

@sydney-runkle sydney-runkle changed the title Update "warnings" parameter typing of BaseModel.model_dump(), BaseModel.model_dump_json(), TypeAdapter.dump_python(), and TypeAdapter.dump_json() to permit a raised exception Update warnings parameter for serialization utilities to allow raising a warning Apr 11, 2024
Copy link
Member

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for your help on this!

@sydney-runkle sydney-runkle enabled auto-merge (squash) April 11, 2024 14:26
@sydney-runkle sydney-runkle merged commit 60d77f0 into pydantic:main Apr 11, 2024
52 of 53 checks passed
@Lance-Drane Lance-Drane deleted the 8978_serialization_error_if_pydantic_core_mismatch branch April 17, 2024 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants