Closed kwisath closed 1 year ago
@kwisath Hi there, thanks for the report!
That's strange. Carmine's commands.edn
file is produced directly from the official command spec.
If there's an incorrect entry in commands.edn
, then it's either a regression in the official spec - or there's a bug in Carmine's command spec parser that appears to be triggering in only this case.
I'm planning to cut a major new Carmine release by the end of June, will take a closer look at this as part of that batched work.
As a temporary workaround in the meantime, you can always use Carmine's redis-call API to send arbitrary commands to Redis.
Thanks @ptaoussanis ! I had a look at the official command spec you linked and the XTRIM appears with a format that I think may be confusing the spec parser (from a semantic point of view the command in the JSON file does not seem to be wrong)
"arguments": [
{
"name": "key",
"type": "key",
"display_text": "key",
"key_spec_index": 0
},
{
"name": "trim",
"type": "block",
"arguments": [
{
"name": "strategy",
"type": "oneof",
"arguments": [
{
"name": "maxlen",
"type": "pure-token",
"display_text": "maxlen",
"token": "MAXLEN"
},
{
"name": "minid",
"type": "pure-token",
"display_text": "minid",
"token": "MINID",
"since": "6.2.0"
}
]
},
{
"name": "operator",
"type": "oneof",
"optional": true,
"arguments": [
{
"name": "equal",
"type": "pure-token",
"display_text": "equal",
"token": "="
},
{
"name": "approximately",
"type": "pure-token",
"display_text": "approximately",
"token": "~"
}
]
},
{
"name": "threshold",
"type": "string",
"display_text": "threshold"
},
{
"name": "count",
"type": "integer",
"display_text": "count",
"token": "LIMIT",
"since": "6.2.0",
"optional": true
}
]
}
The trim
argument in fact has nested arguments inside of it, and maybe the command spec parser is not prepared to deal with that.
The trim argument in fact has nested arguments inside of it, and maybe the command spec parser is not prepared to deal with that.
👍 PR welcome if you feel like taking a stab at updating the parser, otherwise I'll try take a look myself as part of the work for the upcoming v3.3.
Thanks again for pinging about this!
Cheers :-)
Closing, this will be addressed in forthcoming release.
On the commands.edn file of commit 5f9f6b299fae2188b6bf1238b4f03750f21c54df XTRIM is defined as follows
while the traditional way in which it was defined was
Note that the new version has
:fn-params-more nil
which prevents xtrim from being called like(car/xtrim stream :MINID "~" last-ts)
. Per https://redis.io/commands/xtrim/ this type of invocation should be possible (and was totally possible and working as a charm in previous versions of the library due to the& args
in:fn-params-more
).