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

special case of datetime as not allowed in date serializer #873

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

davidhewitt
Copy link
Contributor

@davidhewitt davidhewitt commented Aug 10, 2023

Change Summary

When serializing date | datetime unions we do not want the date serializer to allow datetime inputs, as they are a lossy serialization.

In general this seems undesirable, so I've gone for the approach of making date serializer disallow datetime always (and emit the usual unexpected type warning).

Related issue number

Related to pydantic/pydantic#7039 (comment)

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: @adriangb

@codecov
Copy link

codecov bot commented Aug 10, 2023

Codecov Report

Merging #873 (5fe3498) into main (87b4789) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head 5fe3498 differs from pull request most recent head 143d0f8. Consider uploading reports for the commit 143d0f8 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #873      +/-   ##
==========================================
- Coverage   93.84%   93.83%   -0.01%     
==========================================
  Files         104      104              
  Lines       15380    15372       -8     
  Branches       25       25              
==========================================
- Hits        14433    14424       -9     
- Misses        941      942       +1     
  Partials        6        6              
Files Changed Coverage Δ
src/serializers/type_serializers/datetime_etc.rs 98.48% <100.00%> (+0.17%) ⬆️

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87b4789...143d0f8. Read the comment docs.

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 10, 2023

CodSpeed Performance Report

Merging #873 will not alter performance

Comparing dh/date-datetime-ser (143d0f8) with main (87b4789)

Summary

✅ 138 untouched benchmarks

@davidhewitt
Copy link
Contributor Author

please review

@davidhewitt davidhewitt merged commit 8ac50ec into main Aug 14, 2023
30 checks passed
@davidhewitt davidhewitt deleted the dh/date-datetime-ser branch August 14, 2023 15:30
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.

2 participants