fix GEORADIUS[BYMEMBER] STORE & STOREDIST args spec (#12151)

in GEO commands, `STORE` and `STOREDIST` are mutually exclusive.
use `oneof` block to contain them
This commit is contained in:
Leibale Eidelman 2023-05-09 07:24:37 -04:00 committed by GitHub
parent 6ab2174d37
commit e04ebdb8d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 38 deletions

View File

@ -185,21 +185,26 @@
} }
] ]
}, },
{
"name": "store",
"type": "oneof",
"optional": true,
"arguments": [
{ {
"token": "STORE", "token": "STORE",
"name": "storekey", "name": "storekey",
"display": "key", "display": "key",
"type": "key", "type": "key",
"key_spec_index": 1, "key_spec_index": 1
"optional": true
}, },
{ {
"token": "STOREDIST", "token": "STOREDIST",
"name": "storedistkey", "name": "storedistkey",
"display": "key", "display": "key",
"type": "key", "type": "key",
"key_spec_index": 2, "key_spec_index": 2
"optional": true }
]
} }
], ],
"reply_schema": { "reply_schema": {

View File

@ -176,21 +176,26 @@
} }
] ]
}, },
{
"name": "store",
"type": "oneof",
"optional": true,
"arguments": [
{ {
"token": "STORE", "token": "STORE",
"name": "storekey", "name": "storekey",
"display": "key", "display": "key",
"type": "key", "type": "key",
"key_spec_index": 1, "key_spec_index": 1
"optional": true
}, },
{ {
"token": "STOREDIST", "token": "STOREDIST",
"name": "storedistkey", "name": "storedistkey",
"display": "key", "display": "key",
"type": "key", "type": "key",
"key_spec_index": 2, "key_spec_index": 2
"optional": true }
]
} }
], ],
"reply_schema": { "reply_schema": {

View File

@ -2315,7 +2315,7 @@ int migrateGetKeys(struct redisCommand *cmd, robj **argv, int argc, getKeysResul
/* Helper function to extract keys from following commands: /* Helper function to extract keys from following commands:
* GEORADIUS key x y radius unit [WITHDIST] [WITHHASH] [WITHCOORD] [ASC|DESC] * GEORADIUS key x y radius unit [WITHDIST] [WITHHASH] [WITHCOORD] [ASC|DESC]
* [COUNT count] [STORE key] [STOREDIST key] * [COUNT count] [STORE key|STOREDIST key]
* GEORADIUSBYMEMBER key member radius unit ... options ... * GEORADIUSBYMEMBER key member radius unit ... options ...
* *
* This command has a fully defined keyspec, so returning flags isn't needed. */ * This command has a fully defined keyspec, so returning flags isn't needed. */

View File

@ -513,7 +513,7 @@ void geoaddCommand(client *c) {
#define GEOSEARCHSTORE (1<<4) /* GEOSEARCHSTORE just accept STOREDIST option */ #define GEOSEARCHSTORE (1<<4) /* GEOSEARCHSTORE just accept STOREDIST option */
/* GEORADIUS key x y radius unit [WITHDIST] [WITHHASH] [WITHCOORD] [ASC|DESC] /* GEORADIUS key x y radius unit [WITHDIST] [WITHHASH] [WITHCOORD] [ASC|DESC]
* [COUNT count [ANY]] [STORE key] [STOREDIST key] * [COUNT count [ANY]] [STORE key|STOREDIST key]
* GEORADIUSBYMEMBER key member radius unit ... options ... * GEORADIUSBYMEMBER key member radius unit ... options ...
* GEOSEARCH key [FROMMEMBER member] [FROMLONLAT long lat] [BYRADIUS radius unit] * GEOSEARCH key [FROMMEMBER member] [FROMLONLAT long lat] [BYRADIUS radius unit]
* [BYBOX width height unit] [WITHCOORD] [WITHDIST] [WITHASH] [COUNT count [ANY]] [ASC|DESC] * [BYBOX width height unit] [WITHCOORD] [WITHDIST] [WITHASH] [COUNT count [ANY]] [ASC|DESC]

View File

@ -86,17 +86,17 @@
# Incorrect type for EX 'seconds' parameter - stop hinting. # Incorrect type for EX 'seconds' parameter - stop hinting.
"SET key value EX sec " "" "SET key value EX sec " ""
# Reordering partially-matched optional argument: GEORADIUS key longitude latitude radius M|KM|FT|MI [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC|DESC] [STORE key] [STOREDIST key] # Reordering partially-matched optional argument: GEORADIUS key longitude latitude radius M|KM|FT|MI [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC|DESC] [STORE key|STOREDIST key]
"GEORADIUS key " "longitude latitude radius M|KM|FT|MI [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC|DESC] [STORE key] [STOREDIST key]" "GEORADIUS key " "longitude latitude radius M|KM|FT|MI [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC|DESC] [STORE key|STOREDIST key]"
"GEORADIUS key 1 2 3 M " "[WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC|DESC] [STORE key] [STOREDIST key]" "GEORADIUS key 1 2 3 M " "[WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC|DESC] [STORE key|STOREDIST key]"
"GEORADIUS key 1 2 3 M COUNT " "count [ANY] [WITHCOORD] [WITHDIST] [WITHHASH] [ASC|DESC] [STORE key] [STOREDIST key]" "GEORADIUS key 1 2 3 M COUNT " "count [ANY] [WITHCOORD] [WITHDIST] [WITHHASH] [ASC|DESC] [STORE key|STOREDIST key]"
"GEORADIUS key 1 2 3 M COUNT 12 " "[ANY] [WITHCOORD] [WITHDIST] [WITHHASH] [ASC|DESC] [STORE key] [STOREDIST key]" "GEORADIUS key 1 2 3 M COUNT 12 " "[ANY] [WITHCOORD] [WITHDIST] [WITHHASH] [ASC|DESC] [STORE key|STOREDIST key]"
"GEORADIUS key 1 2 3 M COUNT 12 " "[ANY] [WITHCOORD] [WITHDIST] [WITHHASH] [ASC|DESC] [STORE key] [STOREDIST key]" "GEORADIUS key 1 2 3 M COUNT 12 " "[ANY] [WITHCOORD] [WITHDIST] [WITHHASH] [ASC|DESC] [STORE key|STOREDIST key]"
"GEORADIUS key 1 -2.345 3 M COUNT 12 " "[ANY] [WITHCOORD] [WITHDIST] [WITHHASH] [ASC|DESC] [STORE key] [STOREDIST key]"" "" "GEORADIUS key 1 -2.345 3 M COUNT 12 " "[ANY] [WITHCOORD] [WITHDIST] [WITHHASH] [ASC|DESC] [STORE key|STOREDIST key]"" ""
# Wrong data type: latitude must be a double. Hinting fails. # Wrong data type: latitude must be a double. Hinting fails.
"GEORADIUS key 1 X " "" "GEORADIUS key 1 X " ""
# Once the next optional argument is started, the [ANY] hint completing the COUNT argument disappears. # Once the next optional argument is started, the [ANY] hint completing the COUNT argument disappears.
"GEORADIUS key 1 2 3 M COUNT 12 ASC " "[WITHCOORD] [WITHDIST] [WITHHASH] [STORE key] [STOREDIST key]" "GEORADIUS key 1 2 3 M COUNT 12 ASC " "[WITHCOORD] [WITHDIST] [WITHHASH] [STORE key|STOREDIST key]"
# Incorrect argument type for double-valued token parameter. # Incorrect argument type for double-valued token parameter.
"GEOSEARCH k FROMLONLAT " "longitude latitude BYRADIUS radius M|KM|FT|MI|BYBOX width height M|KM|FT|MI [ASC|DESC] [COUNT count [ANY]] [WITHCOORD] [WITHDIST] [WITHHASH]" "GEOSEARCH k FROMLONLAT " "longitude latitude BYRADIUS radius M|KM|FT|MI|BYBOX width height M|KM|FT|MI [ASC|DESC] [COUNT count [ANY]] [WITHCOORD] [WITHDIST] [WITHHASH]"