User-defined vector input function in JuMP 0.18.6

Is it possible to have user-defined functions with vector input in JuMP 0.18.6? Or is there a way to do similar things? I would like to use the NLopt solver (https://github.com/JuliaOpt/NLopt.jl) and it seems that this solver is not supported after JuMP 0.18.

For example, is it possible to do something like

function f(x)
return dot(x,x)
end

function g(x)
return dot(x,x)
end
Model = (model, solver=NLoptSolver(algorithm=:LD_MMA))
@variable(model, x[1:n])
@objective(model, Min, f(x))
@constraint(model, g(x)<=0)
solve(model)

For n large, it will be very time-consuming to list x[1],…,x[n] as scalar one by one.

It seems that we can do the vector input by Julia’s splatting syntax in JuMP0.21.3, as shown below:

I tried this in JuMP 0.18.6 but got an error.

Another question is, if the solver I use doesn’t require derivative, do I need to set autodiff=false?