Plumber decorations for payload parameter in body of a request

plumber

#1

There is very limited documentation for the allowable decorations in plumber markup. For instance, I'm struggling to get Swagger to correctly annotate the payload of a @post request.

        - name: payload
          required: true
          in: body
          schema:
            $ref: '#...'

None of the given examples, or anything I've thought to try, match the correctness of the corresponding curl request.

From the examples:

#' @post /user
function(req, id, name){
  list(
    id = id,
    name = name,
    raw = req$postBody
  )
}

produces an API that responds correctly to the curl request

curl --data "id=123&name=Jennifer" "http://localhost:8000/user"

but the Swagger page doesn't create the correct payload parameter.

What am I missing?


#2

Unfortunately Plumber does not currently support annotating the payload of a POST request. If the payload is JSON or a query string it is automatically parsed and objects are made available as arguments to endpoint functions. When this is the case, you can annotate parameters of a POST request (ie #* @param id ID of the user), although that is quite a bit different from annotating the payload itself.


#3

Ah, thanks for confirming.