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

reject is_instance inputs based on their type, not the mode #765

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

davidhewitt
Copy link
Contributor

@davidhewitt davidhewitt commented Jul 12, 2023

Change Summary

This changes the way the is-instance validator is disabled to reject inputs based on whether they originated from Python or JSON, not based on the parse mode.

This allows is_instance validation to be possible when coming from JSON, provided you use a before or wrapping validator function (etc) which coerces the input to Python first.

Related issue number

Ref pydantic/pydantic#6573

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer: @samuelcolvin

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 12, 2023

CodSpeed Performance Report

Merging #765 will not alter performance

Comparing dh/pyd-issue-6571 (0be0d24) with main (a3b9788)

Summary

✅ 126 untouched benchmarks

@adriangb
Copy link
Member

Can you make a pydantic PR to prove this works?

@davidhewitt
Copy link
Contributor Author

Try rebase on #767 and we should know :)

@davidhewitt
Copy link
Contributor Author

test-pydantic-integration here is all green, please review

@adriangb adriangb merged commit 33fea1e into main Jul 18, 2023
29 checks passed
@adriangb adriangb deleted the dh/pyd-issue-6571 branch July 18, 2023 09:51
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.

3 participants