如何更改文件规范中 AQL 查询的包含部分

How to change the include section of an AQL query in a file spec

我想更改格式化为 Artifactory 文件规范的 AQL 字符串的输出。

查询如下所示:

{
    "files": [
        {
            "aql": {
                "items.find":{
                    "repo":"gradle-dev-local",
                    "$or":[
                        {
                            "$and": [
                                { "stat.downloads": { "$eq":null } },
                                { "updated": { "$before": "7d" } }
                            ]
                        },
                        {
                            "$and": [
                                { "stat.downloads": { "$gt": 0 } },
                                { "stat.downloaded": { "$before": "30d" } }
                            ]
                        }
                    ]
                }
            }
        }
    ]
}

在纯 AQL REST API 调用中,我将包括以下内容:

"include":["repo", "name", "path", "updated", "sha256", "stat.downloads", "stat.downloaded"]

但是在使用时,它没有被传递到查询的正确部分,导致出现以下错误信息:

Failed to parse query: items.find({  
                    "repo":"mfm-gradle-dev-local",  
                    "$or":[  
                        {  
                            "$and": [  
                                { "stat.downloads": { "$eq":null } },  
                                { "updated": { "$before": "7d" } }  
                            ]  
                        },  
                        {  
                            "$and": [  
                                { "stat.downloads": { "$gt": 0 } },  
                                { "stat.downloaded": { "$before": "30d" } }  
                            ]  
                        }  
                    ]  
                },  
                "include":["repo", "name", "path", "updated", "sha256", "stat.downloads", "stat.downloaded"]  
            ).include("name","repo","path","actual_md5","actual_sha1","size","type","property"), it looks like there is syntax error near the following sub-query:    "include":["repo", "name", "path", "updated", "sha256", "stat.downloads", "stat.downloaded"]

如何格式化 AQL 以便包含语句也能通过?

如果您使用的是 JFrog CLI,则存在一个未解决的问题 (github.com/jfrog/jfrog-cli-go/issues/320),以便能够在搜索查询中添加包含项(同时使用 -s 参数和文件规范)。如果到目前为止我们遗漏了什么,请随时为该问题添加更多信息。