[go: up one dir, main page]

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

Better error response for wrong datetime format in REST filter #3531

Open
timvisee opened this issue Feb 5, 2024 · 10 comments
Open

Better error response for wrong datetime format in REST filter #3531

timvisee opened this issue Feb 5, 2024 · 10 comments

Comments

@timvisee
Copy link
Member
timvisee commented Feb 5, 2024

Is your feature request related to a problem? Please describe.
We recently merged #3395 which adds a datetime payload index.

Currently, the datetime parser is very strict, only allowing RFC 3339 formats in our REST API. A common format such as YYYY-MM-DD HH:MM:SS is currently not accepted.

If you'd send the following request:

POST collections/test_collection/points/scroll
{
  "limit": 10,
  "filter": {
    "must": [
      {
        "key": "updated",
        "datetime_range": {
          "gt": "2014-01-01T00:00:00"
        }
      }
    ]
  }
}

You'd receive the following error:

Format error in JSON body: data did not match any variant of untagged enum Condition at line 1 column 96

This error is very confusing.

Describe the solution you'd like
We'd strongly prefer a more descriptive error message instead.

Something like this would be a lot better:

Format error in JSON body: '2014-01-01T00:00:00' does not match any accepted datetime format

Describe alternatives you've considered
None

Additional context
Related issue: #3529

@timvisee timvisee changed the title Better error handling for datetime in REST filter Better error response for wrong datetime format in REST filter Feb 5, 2024
@kartikchoubisa
Copy link

Much needed. I'd rather have it parse multiple formats, but for now I don't mind having at least a better error message.
I could take up this issue

@generall
Copy link
Member

@kartikchoubisa it is already merged

@generall
Copy link
Member

/bounty $100

Copy link
algora-pbc bot commented Apr 23, 2024

💎 $100 bounty • Qdrant

Steps to solve:

  1. Start working: Comment /attempt #3531 with your implementation plan
  2. Submit work: Create a pull request including /claim #3531 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to qdrant/qdrant!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🔴 @syedbarimanjan Apr 23, 2024, 11:58:24 PM WIP
🟢 @gsaivinay Apr 24, 2024, 7:12:42 PM #4111
🟢 @Pushkarm029 Sep 26, 2024, 5:14:37 AM #5164

@gsaivinay
Copy link
Contributor
gsaivinay commented Apr 24, 2024

/attempt #3531

Algora profile Completed bounties Tech Active attempts Options
@gsaivinay 1 Qdrant bounty
Python
Cancel attempt

Copy link
algora-pbc bot commented Apr 24, 2024

💡 @gsaivinay submitted a pull request that claims the bounty. You can visit your bounty board to reward.

@Pushkarm029
Copy link

Can I work on this one? I think @gsaivinay is no longer interested in working on it.

@Pushkarm029
Copy link

Since, no one is responding. I think i am free to work on this.

/attempt #3531

@timvisee
Copy link
Member Author

Yes, please feel free!

Note that this seems to be quite difficult to achieve. We don't want to make significant changes in our deserializing logic just to make this happen.

But if you think this can be done without much changes, please feel free to give it a shot in a PR.

@Pushkarm029
Copy link

It seems this is an upstream issue: collecting errors when deserializing untagged enums is not currently supported by serde-rs, and there are no plans to add this feature by the serde-rs maintainers.

I also tried using serde_path_to_error, but it didn't work as expected.

If this issue becomes a higher priority in the future, we could consider adding tags for these enums to work around the limitation.

Closing my PR #5164.

Reference:

  1. Collect errors when deserializing untagged enums serde-rs/serde#1544
  2. When a serde(untagged) enum can't deser, show all the reasons why serde-rs/serde#2376 (comment)
  3. When a serde(untagged) enum can't deser, show all the reasons why serde-rs/serde#2376 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants