Skip to content

Conversation

thejcannon
Copy link
Contributor

@thejcannon thejcannon commented Dec 1, 2024

Change Summary

Quick-and-simple. Just .copy() the return self.json_schema inside of WithJsonSchema so that other parts of the pipeline that modify the schema don't modify the shared object.

Related issue number

Fix #11013

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: @sydney-runkle

@github-actions github-actions bot added the relnotes-fix Used for bugfixes. label Dec 1, 2024
Copy link

codspeed-hq bot commented Dec 1, 2024

CodSpeed Performance Report

Merging #11014 will not alter performance

Comparing thejcannon:patch-1 (1da5638) with main (6f31f8f)

Summary

✅ 46 untouched benchmarks

Copy link
Contributor

github-actions bot commented Dec 1, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic
  json_schema.py
Project Total  

This report was generated by python-coverage-comment-action

@thejcannon thejcannon marked this pull request as ready for review December 1, 2024 14:47
@thejcannon
Copy link
Contributor Author

please review (and thank you ❤️ )

Copy link
Contributor

@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.

@Viicos and I discussed this. Happy to accept this fix for now. We think a shallow copy is appropriate, though if any other issues are raised related to this, we could consider a deepcopy instead.

Thanks for your contribution!

@sydney-runkle sydney-runkle merged commit 9553fa4 into pydantic:main Jan 2, 2025
52 checks passed
@thejcannon thejcannon deleted the patch-1 branch January 2, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

default added to Annotated type when WithJsonSchema is used
2 participants