Skip to content

Conversation

irevoire
Copy link
Contributor

Parse the Duration and timestamp with the iso8601-duration and the time crate

@irevoire irevoire marked this pull request as draft February 14, 2022 11:57
@irevoire
Copy link
Contributor Author

Oops sorry I created this PR a little bit too early

@irevoire irevoire force-pushed the time branch 2 times, most recently from e5780b5 to 18255b1 Compare February 14, 2022 12:42
@irevoire
Copy link
Contributor Author

Now it’s ready to review 👍

@irevoire irevoire marked this pull request as ready for review February 14, 2022 12:42
Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

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

I have some doubts! 😅

[dependencies]
async-trait = "0.1.51"
serde_json = "1.0"
iso8601-duration = "0.1.0"
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the newbie here 😅

I think I get the idea, but just to be sure, the users of the rust-sdk don't need to have these time-handling libraries on their apps?
In other words, to be able to use some function they need to have the lib, in order to have the right types to pass to the function?

Copy link
Contributor Author

@irevoire irevoire Feb 14, 2022

Choose a reason for hiding this comment

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

The iso8601-duration crate is never exposed to the end-user, but sadly the time crate will be needed if someone wants to manipulate API keys.

For the context, there was a lot of TODO: use chrono (which is one of the biggest time crates in the rust ecosystem).
And there was this comment asking for a real « time » type instead of String in the SDK: meilisearch/integration-guides#121 (comment)

And the reason why we’re not using chrono is here: #226
There is a bunch (2 or 3, I think) of CVE on chrono that are not fixed because the crate is not really maintained anymore.
But for our use case, chrono was just a wrapper around time (which is maintained and fixed all of the CVE encountered in chrono), so I decided to import this one instead of chrono.
Also, time is way smaller than chrono, and you can configure a lot of features depending on your needs.

But yes, to conclude, a user of the meilisearch-rust sdk can do most of the thing without any problem, but if he wants to use inspect, create or update anything related to the OffsetDateTime, he’ll need to import time in his crate.

Kerollmops
Kerollmops previously approved these changes Feb 15, 2022
Copy link
Member

@Kerollmops Kerollmops left a comment

Choose a reason for hiding this comment

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

It looks good to me, thank you @irevoire!
Will let @brunoocasali merge it then :)

@curquiza curquiza added the breaking-change The related changes are breaking for the users label Feb 15, 2022
@curquiza
Copy link
Member

curquiza commented Feb 15, 2022

I put the breaking change label since it impacts the user experience (cf code sample changes) 🙂
Tell me if I'm wrong

@brunoocasali
Copy link
Member

bors merge

bors bot added a commit that referenced this pull request Feb 16, 2022
237: Put type on timestamp and duration r=brunoocasali a=irevoire

Parse the Duration and timestamp with the `iso8601-duration` and the `time` crate

Co-authored-by: Irevoire <[email protected]>
@brunoocasali brunoocasali self-requested a review February 16, 2022 12:41
@bors
Copy link
Contributor

bors bot commented Feb 16, 2022

This PR was included in a batch that successfully built, but then failed to merge into main. It will not be retried.

Additional information:

{"message":"At least 1 approving review is required by reviewers with write access.","documentation_url":"https://docs.github.com/articles/about-protected-branches"}

Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

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

🔥 🚒

@brunoocasali
Copy link
Member

bors merge

@bors
Copy link
Contributor

bors bot commented Feb 16, 2022

Build succeeded:

@bors bors bot merged commit 485f19a into meilisearch:main Feb 16, 2022
bors bot added a commit that referenced this pull request Feb 16, 2022
243: Update version for the next release (v0.15.0) r=brunoocasali a=brunoocasali

## ⚠️ Breaking changes

* Refactorise the errors, now `error_code` and `error_type` has types instead of `string` (#234) `@irevoire`
* Put type on timestamp and duration (#237) `@irevoire`
  * The `time` crate will be needed if you need to manipulate API keys (check for more info #226, #237 (comment), and meilisearch/integration-guides#121 (comment)).

## 🚀 Enhancements

* Refactorise the settings (#235) `@irevoire`

Thanks again to `@irevoire!` 🎉


Co-authored-by: Bruno Casali <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change The related changes are breaking for the users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants