Skip to content

Commit 2a0af6e

Browse files
committed
fix a bunch of checks
1 parent 3a1a750 commit 2a0af6e

17 files changed

+60
-32
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
^LICENSE\.md$
77
^[\.]?air\.toml$
88
^\.vscode$
9+
^vignettes/_ex*$

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export(show_registered_parsers)
111111
export(show_registered_serializers)
112112
import(rlang)
113113
importFrom(R6,R6Class)
114+
importFrom(base64enc,base64decode)
114115
importFrom(fiery,Fire)
115116
importFrom(jsonlite,write_json)
116117
importFrom(ragg,agg_jpeg)

R/parsers.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ parse_geojson <- function(...) {
330330
}
331331
}
332332
#' @rdname parsers
333+
#' @param parsers A list of parsers to use for parsing the parts of the body
333334
#' @export
334335
#'
335336
parse_multipart <- function(parsers = get_parsers()) {

R/type_caster.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type_caster <- function(schema, required, name, loc) {
5454
}
5555

5656
caster_constructor <- function(coercer, ...) {
57+
args <- list2(...)
5758
function(schema, required, name, loc) {
5859
error_string <- missing_required_error_string(name, loc)
5960
default <- schema$default
@@ -66,7 +67,7 @@ caster_constructor <- function(coercer, ...) {
6667
}
6768
NULL
6869
} else {
69-
suppressWarnings(coercer(val, ...))
70+
suppressWarnings(inject(coercer(val, !!!args)))
7071
}
7172
}
7273
}
@@ -76,14 +77,15 @@ number_caster <- caster_constructor(as.numeric)
7677
integer_caster <- caster_constructor(as.integer)
7778
bool_caster <- caster_constructor(as.logical)
7879
date_caster <- caster_constructor(as.Date, format = "%Y-%m-%d")
79-
datetime_caster <- caster_constructor(function(x) {
80+
datetime_caster <- caster_constructor(function(x, ...) {
8081
as.POSIXlt(
8182
sub(":(\\d\\d)$", "\\1", sub("Z$", "+0000", x)),
8283
format = "%FT%T%z"
8384
)
8485
})
85-
byte_caster <- caster_constructor(base64enc::base64decode)
86-
required_caster <- caster_constructor(identity)
86+
#' @importFrom base64enc base64decode
87+
byte_caster <- caster_constructor(base64decode)
88+
required_caster <- caster_constructor(function(x, ...) x)
8789

8890
string_caster <- function(schema, required, name, loc) {
8991
switch(

man/parsers.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/_helpers.R

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
library(plumber2)
22

3-
knitr::opts_chunk$set(
4-
collapse = FALSE,
5-
comment = "#>"
6-
)
7-
83
code_chunk <- function(output, language=""){
94
cat(paste0("```",language,"\n"))
105
output <- switch(
@@ -26,6 +21,3 @@ code_chunk <- function(output, language=""){
2621
json_serialize <- function(obj){
2722
jsonlite::toJSON(obj, auto_unbox = FALSE, pretty = TRUE)
2823
}
29-
pretty_json_output <- function(x) {
30-
code_chunk()
31-
}

vignettes/annotations.qmd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Annotations reference"
3+
knitr:
4+
opts_chunk:
5+
collapse: false
6+
comment: "#>"
37
vignette: >
48
%\VignetteIndexEntry{Annotations reference}
59
%\VignetteEngine{quarto::html}
@@ -360,6 +364,6 @@ use_swagger
360364

361365
```{r}
362366
#| output: false
363-
api() %>%
367+
api() |>
364368
api_doc_setting("swagger")
365369
```

vignettes/execution-model.qmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Runtime"
3+
knitr:
4+
opts_chunk:
5+
collapse: false
6+
comment: "#>"
37
vignette: >
48
%\VignetteIndexEntry{Runtime}
59
%\VignetteEngine{quarto::html}

vignettes/hosting.qmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Hosting"
3+
knitr:
4+
opts_chunk:
5+
collapse: false
6+
comment: "#>"
37
vignette: >
48
%\VignetteIndexEntry{Hosting}
59
%\VignetteEngine{quarto::html}

vignettes/introduction.qmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Introduction"
3+
knitr:
4+
opts_chunk:
5+
collapse: false
6+
comment: "#>"
37
vignette: >
48
%\VignetteIndexEntry{Introduction}
59
%\VignetteEngine{quarto::html}

0 commit comments

Comments
 (0)