我有一个API,我想根据用户输入(Z)定制输入参数
#* @param a Enter your Website
#* @param z Enter No of competitor you want to check
#* @param b Enter First URL
#* @param c Enter Second URL
#* @param d Enter Third URL
#* @param e Enter Fourth URL
#* @param f Enter Fifth URL
#* @param g Enter Sixth URL
#* @param h Enter Seventh URL
#* @param i Enter Eighth URL
#* @param j Enter Ninth URL
#* @param k Enter Tenth URL
#* @param v The focused keyword
function(a,z,v) {}这条路对吗?有没有人能提个建议?
发布于 2020-10-15 22:28:40
使用plumber 1.0.0,让它们变成一个数组?
library(plumber)
#* @param a Enter your Website
#* @param b:[chr] Enter URLs
#* @param v The focused keyword
#* @get /something
function(a,b,v) {
if (length(b) > 10) {
stop("this api can handle at most 10 urls")
}
length(b)
}
#* @plumber
function(pr) {
pr_set_api_spec(pr, function(spec) {
spec$paths$`/something`$get$parameters[[2]]$schema$maxItems = 10
spec
})
pr_set_debug(pr, TRUE)
}https://stackoverflow.com/questions/64370824
复制相似问题