I have a plumber API.
#* API title
#* @param param1
#*
#* @post /method_name
function(x) x
The default behaviour is to convert param1
to a string, then I would need to use as.numeric(x)
in the function body. Is there a way to specify the input type of each parameter? And if I have 40 parameters, all of which are numeric, is there a way to specify every parameter as numeric?
CodePudding user response:
You can set the type for a specific parameter using param:type
. Let's say you want param1
to be an integer, then we can do:
#* API title
#* @param param1:int
#*
#* @post /method_name
function(x) x
I'm unaware of how to specify 40 parameters in an automated way that isn't just #* @param paramx:int
repeated for x from 1 to 40. You can see the details on type in the annotations documentation for plumber
.