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 potential json_encoding date error and truncation in pydantic < 2 #807

Merged
merged 4 commits into from
Jul 28, 2023

Conversation

sanders41
Copy link
Collaborator

Pull Request

I came across some instances that can cause the current json_encoder for dates to either error or return truncated values in Pydantic < 2. The encoder this is updating is the same one we have been using all along and no one reported issues so it seems as though I just stumbled upon this by chance.

Related issue

Fixes #<issue_number>

What does this PR do?

  • Handles the date when it ends in +00:00
  • Properly handle Z dates to prevent truncation

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

@sanders41 sanders41 added the bug Something isn't working label Jul 20, 2023
Copy link
Contributor

@alallema alallema left a comment

Choose a reason for hiding this comment

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

Good catch @sanders41 🚀
I've never encountered this problem either, but I'm sure we never test dates with Z either.
LGTM! 🎉

@alallema alallema merged commit 84517d6 into main Jul 28, 2023
9 checks passed
@alallema alallema deleted the json-encoder branch July 28, 2023 15:39
meili-bors bot added a commit that referenced this pull request Jul 31, 2023
815: Update version for the next release (v0.28.2) r=sanders41 a=meili-bot

This version introduces features released on Meilisearch v1.3.0 🎉
Check out the changelog of [Meilisearch v1.3.0](https://github.com/meilisearch/meilisearch/releases/tag/v1.3.0) for more information on the changes. 

⚠️ If you want to adopt new features of this release, **update the Meilisearch server** to the according version.

## 🚀 Enhancements

* ⚠️ **EXPERIMENTAL**: Adds docstring and tests for vector search (#805) `@sanders41` 

⚠️ The EXPERIMENTAL features are not covered by semver. To explicitly opt-in, check this [guide](https://www.meilisearch.com/docs/reference/api/experimental-features).

## 🐛 Bug Fixes

* Fix potential json_encoding date error and truncation in pydantic < 2 (#807) `@sanders41`

## 💅 Misc

* Migrate docs hosting to Meilisearch subdomain (#810) `@Strift`
* Update documentation deployment workflow (#811) `@Strift` 

Thanks again to `@Strift,` `@alallema,` and `@sanders41!` 🎉

Co-authored-by: meili-bot <74670311+meili-bot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants