How to add value for @apiVersion from file

Is there a way to assign the value of the global annotation @apiVersion from a file?

This doesn't work:

#* @apiVersion readLines("../version", warn = FALSE)

You can modify the spec using a plumber decorator to modify the plumber object.

#* @plumber
function(pr) {
  oas <- function(spec) {
    spec[["info"]][["version"]] <- jsonlite::fromJSON("version.json")[["version"]]
    spec
  }
  pr[["setApiSpec"]](oas)
  return(pr)
}

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.