plumber icon indicating copy to clipboard operation
plumber copied to clipboard

Feature request: add inheritParams functionality

Open isteves opened this issue 7 years ago • 0 comments

The roxygen2 tag @inheritParams is used to grab & reuse documentation written elsewhere. http://r-pkgs.had.co.nz/man.html A similar type of tag would be a great feature to have in Plumber!

This comes in handy if you:

  • have several functions in the API with the same parameters (for example, if you have a user_id parameter that is used in several functions)
  • wrap a function with documentation written out elsewhere

For example, you could do this:

#* Paste API
#* @inheritParams base::paste
#* @get /paste
function(..., sep = " ", collapse = NULL){
  paste(..., sep = sep, collapse = collapse)
}

rather than this:

#* Paste API
#* @param ... one or more R objects
#* @param sep a character string to separate the terms
#* @param collapse an optional character string to separate the results
#* @get /paste
function(..., sep = " ", collapse = NULL){
  paste(..., sep = sep, collapse = collapse)
}

isteves avatar Aug 09 '18 18:08 isteves