-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Un-deprecate Plumber$run(swaggerCallback=, debug=)
and add Plumber$run(docs=,quiet=)
#765
Changes from 4 commits
574ec13
b642e2e
b795633
2aa507f
45536d5
0f9de8a
6a2af47
fc33270
07430f4
f43ce6c
a8948f5
755b71f
d12bd19
8a0240b
8f172bc
274b530
ae6c7d8
077aa53
e32103f
a0b0825
e90deca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -145,14 +145,18 @@ Plumber <- R6Class( | |||||||||||
#' This value does not need to be explicitly assigned. To explicitly set it, see [options_plumber()]. | ||||||||||||
#' @param debug Deprecated. See `$setDebug()` | ||||||||||||
#' @param swagger Deprecated. See `$setDocs(docs)` or `$setApiSpec()` | ||||||||||||
#' @param swaggerCallback Deprecated. See `$setDocsCallback()` | ||||||||||||
#' @param swaggerCallback An optional single-argument function that is | ||||||||||||
#' called back with the URL to an OpenAPI user interface when one becomes | ||||||||||||
#' ready. If missing, defaults to `$setDocsCallback()`. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
#' @param quiet If `TRUE`, don't print routine startup messages. | ||||||||||||
schloerke marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
#' @importFrom lifecycle deprecated | ||||||||||||
run = function( | ||||||||||||
host = '127.0.0.1', | ||||||||||||
port = getOption('plumber.port', NULL), | ||||||||||||
swagger = deprecated(), | ||||||||||||
debug = deprecated(), | ||||||||||||
swaggerCallback = deprecated() | ||||||||||||
swaggerCallback, | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add in
Suggested change
|
||||||||||||
quiet = FALSE | ||||||||||||
) { | ||||||||||||
|
||||||||||||
if (isTRUE(private$disable_run)) { | ||||||||||||
schloerke marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
|
@@ -184,14 +188,16 @@ Plumber <- R6Class( | |||||||||||
} | ||||||||||||
} | ||||||||||||
} | ||||||||||||
if (lifecycle::is_present(swaggerCallback)) { | ||||||||||||
lifecycle::deprecate_warn("1.0.0", "run(swaggerCallback = )", "setDocsCallback(callback = )") | ||||||||||||
self$setDocsCallback(swaggerCallback) | ||||||||||||
|
||||||||||||
if (missing(swaggerCallback)) { | ||||||||||||
swaggerCallback <- private$docs_callback | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
} | ||||||||||||
|
||||||||||||
port <- findPort(port) | ||||||||||||
|
||||||||||||
message("Running plumber API at ", urlHost(host = host, port = port, changeHostLocation = FALSE)) | ||||||||||||
if (!isTRUE(quiet)) { | ||||||||||||
message("Running plumber API at ", urlHost(host = host, port = port, changeHostLocation = FALSE)) | ||||||||||||
} | ||||||||||||
|
||||||||||||
# Set and restore the wd to make it appear that the proc is running local to the file's definition. | ||||||||||||
if (!is.null(private$filename)) { | ||||||||||||
|
@@ -205,7 +211,8 @@ Plumber <- R6Class( | |||||||||||
host = host, | ||||||||||||
port = port, | ||||||||||||
docs_info = private$docs_info, | ||||||||||||
callback = private$docs_callback | ||||||||||||
callback = swaggerCallback, | ||||||||||||
schloerke marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
quiet = quiet | ||||||||||||
) | ||||||||||||
on.exit(unmount_docs(self, private$docs_info), add = TRUE) | ||||||||||||
} | ||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -475,6 +475,10 @@ pr_filter <- function(pr, | |||||||
#' @param port A number or integer that indicates the server port that should | ||||||||
#' be listened on. Note that on most Unix-like systems including Linux and | ||||||||
#' Mac OS X, port numbers smaller than 1025 require root privileges. | ||||||||
#' @param swaggerCallback An optional single-argument function that is called | ||||||||
#' back with the URL to an OpenAPI user interface when one becomes ready. If | ||||||||
#' missing, defaults to `$setDocsCallback()`. | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
#' @param quiet If `TRUE`, don't print routine startup messages. | ||||||||
schloerke marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
#' | ||||||||
#' @examples | ||||||||
#' \dontrun{ | ||||||||
|
@@ -488,11 +492,15 @@ pr_filter <- function(pr, | |||||||
#' @export | ||||||||
pr_run <- function(pr, | ||||||||
host = '127.0.0.1', | ||||||||
port = getOption('plumber.port', NULL) | ||||||||
port = getOption('plumber.port', NULL), | ||||||||
swaggerCallback, | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
quiet = FALSE | ||||||||
) { | ||||||||
validate_pr(pr) | ||||||||
schloerke marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
pr$run(host = host, | ||||||||
port = port) | ||||||||
port = port, | ||||||||
swaggerCallback = swaggerCallback, | ||||||||
schloerke marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
quiet = quiet) | ||||||||
} | ||||||||
|
||||||||
|
||||||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.