mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
Add the deprecated_since field in command args of COMMAND DOCS (#10545)
Apparently, some modules can afford deprecating command arguments (something that was never done in Redis, AFAIK), so in order to represent this piece of information, we added the `deprecated_since` field to redisCommandArg (in symmetry to the already existing `since` field). This commit adds `const char *deprecated_since` to `RedisModuleCommandArg`, which is technically a breaking change, but since 7.0 was not released yet, we decided to let it slide
This commit is contained in:
parent
bd8da0ca29
commit
e875ff89ec
@ -1931,6 +1931,7 @@ static struct redisCommandArg *moduleCopyCommandArgs(RedisModuleCommandArg *args
|
||||
if (arg->token) realargs[j].token = zstrdup(arg->token);
|
||||
if (arg->summary) realargs[j].summary = zstrdup(arg->summary);
|
||||
if (arg->since) realargs[j].since = zstrdup(arg->since);
|
||||
if (arg->deprecated_since) realargs[j].deprecated_since = zstrdup(arg->deprecated_since);
|
||||
realargs[j].flags = moduleConvertArgFlags(arg->flags);
|
||||
if (arg->subargs) realargs[j].subargs = moduleCopyCommandArgs(arg->subargs, version);
|
||||
}
|
||||
@ -10941,6 +10942,7 @@ int moduleFreeCommand(struct RedisModule *module, struct redisCommand *cmd) {
|
||||
}
|
||||
zfree((char *)cmd->summary);
|
||||
zfree((char *)cmd->since);
|
||||
zfree((char *)cmd->deprecated_since);
|
||||
zfree((char *)cmd->complexity);
|
||||
if (cmd->latency_histogram) {
|
||||
hdr_close(cmd->latency_histogram);
|
||||
|
@ -322,6 +322,7 @@ typedef struct RedisModuleCommandArg {
|
||||
const char *summary;
|
||||
const char *since;
|
||||
int flags; /* The REDISMODULE_CMD_ARG_* macros. */
|
||||
const char *deprecated_since;
|
||||
struct RedisModuleCommandArg *subargs;
|
||||
} RedisModuleCommandArg;
|
||||
|
||||
|
@ -4317,6 +4317,7 @@ void addReplyCommandArgList(client *c, struct redisCommandArg *args, int num_arg
|
||||
if (args[j].token) maplen++;
|
||||
if (args[j].summary) maplen++;
|
||||
if (args[j].since) maplen++;
|
||||
if (args[j].deprecated_since) maplen++;
|
||||
if (args[j].flags) maplen++;
|
||||
if (args[j].type == ARG_TYPE_ONEOF || args[j].type == ARG_TYPE_BLOCK)
|
||||
maplen++;
|
||||
@ -4344,6 +4345,10 @@ void addReplyCommandArgList(client *c, struct redisCommandArg *args, int num_arg
|
||||
addReplyBulkCString(c, "since");
|
||||
addReplyBulkCString(c, args[j].since);
|
||||
}
|
||||
if (args[j].deprecated_since) {
|
||||
addReplyBulkCString(c, "deprecated_since");
|
||||
addReplyBulkCString(c, args[j].deprecated_since);
|
||||
}
|
||||
if (args[j].flags) {
|
||||
addReplyBulkCString(c, "flags");
|
||||
addReplyFlagsForArg(c, args[j].flags);
|
||||
|
@ -2042,6 +2042,7 @@ typedef struct redisCommandArg {
|
||||
const char *summary;
|
||||
const char *since;
|
||||
int flags;
|
||||
const char *deprecated_since;
|
||||
struct redisCommandArg *subargs;
|
||||
/* runtime populated data */
|
||||
int num_args;
|
||||
|
@ -175,6 +175,8 @@ class Argument(object):
|
||||
get_optional_desc_string(self.desc, "since"),
|
||||
_flags_code(),
|
||||
)
|
||||
if "deprecated_since" in self.desc:
|
||||
s += ",.deprecated_since=\"%s\"" % self.desc["deprecated_since"]
|
||||
if self.subargs:
|
||||
s += ",.subargs=%s" % self.subarg_table_name()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user