redis-doc icon indicating copy to clipboard operation
redis-doc copied to clipboard

ZRANGEBYSCORE min/max argument types not complete

Open mmkal opened this issue 5 years ago • 2 comments

In commands.json, ZRANGEBYSCORE has its min and max arguments as double: https://github.com/redis/redis-doc/blob/e978cf5875a257ba4a3389abfa844a23df28c0f0/commands.json#L3806-L3813

But the value is also allowed to be +inf, -inf, (1 etc.

Likewise with ZREMRANGEBYSCORE, ZREVRANGEBYSCORE and ZCOUNT.

It'd be great if commands.json could somehow indicate that more than just double is allowed.

Note that https://github.com/redis/redis-doc/pull/1232 would solve this problem with no extra effort, because this is already possible to express precisely with json schema:

name: min
schema:
  anyOf:
  - type: number
  - type: string
    enum: [-inf, +inf]
  - type: string
    pattern: ^\(\d+(\.\d+)?$
json equivalent
{
   "name": "min",
   "schema": {
      "anyOf": [
         {
            "type": "number"
         },
         {
            "type": "string",
            "enum": [
               "-inf",
               "+inf"
            ]
         },
         {
            "type": "string",
            "pattern": "^\\(\\d+(\\.\\d+)?$"
         }
      ]
   }
}

Related: https://github.com/mmkal/handy-redis/issues/30

mmkal avatar Oct 21 '20 18:10 mmkal

I think the issue is resolved in this pull request (https://github.com/mmkal/handy-redis/pull/240). This issue can be closed

ayruslore avatar Jan 16 '21 10:01 ayruslore

That's just a workaround in a downstream library. The issue is that commands.json in this repo reports an incomplete type for the min/max arguments, and that's still the case, so it shouldn't be closed.

mmkal avatar Jan 16 '21 14:01 mmkal