Skip to content

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

@timvisee

Description

@timvisee

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",
        "range": {
          "gt": "2014-01-01T00:00:00BAD"
        }
      }
    ]
  }
}

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions