You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: NEWS.md
+6
Original file line number
Diff line number
Diff line change
@@ -14,12 +14,18 @@
14
14
15
15
* Mounts now have a dynamic `req$PATH_INFO` instead of a pre-computed value. (#888)
16
16
17
+
*`validate_api_spec()` now uses `@redocly/cli` to validate the API spec. (#986)
18
+
19
+
* Added `operationId` to each operation within the auto-generated OpenAPI output. The value is similar to the `PATH-VERB`, e.g. `/users/create-POST`. (#986)
20
+
21
+
17
22
# plumber 1.2.2
18
23
19
24
* Allow to set plumber options using environment variables `?options_plumber`. (@meztez#934)
20
25
* Add support for quoted boundary for multipart request parsing. (@meztez#924)
21
26
* Fix #916, related to `parseUTF8` return value attribute `srcfile` on Windows. (#930)
stop("Could not install npm dependencies required for plumber::validate_api_spec()")
40
-
}
41
-
42
-
invisible(TRUE)
43
-
}
44
-
45
-
46
1
#' Validate OpenAPI Spec
47
2
#'
48
-
#' Validate an OpenAPI Spec using [Swagger CLI](https://github.com/APIDevTools/swagger-cli) which calls [Swagger Parser](https://github.com/APIDevTools/swagger-parser).
3
+
#' Validate an OpenAPI Spec using [`@redocly/cli`](https://redocly.com/docs/cli/commands/lint).
49
4
#'
50
-
#' If the api is deemed invalid, an error will be thrown.
5
+
#' If any warning or error is presented, an error will be thrown.
51
6
#'
52
-
#' This function is VERY `r lifecycle::badge("experimental")` and may be altered, changed, or removed in the future.
7
+
#' This function is `r lifecycle::badge("experimental")` and may be altered, changed, or removed in the future.
53
8
#'
54
9
#' @param pr A Plumber API
10
+
#' @param ... Ignored
11
+
#' @param ruleset Character that determines the ruleset to use for validation. Can be one of "minimal", "recommended",
12
+
#' or "recommended-strict". Defaults to "minimal". See [`@redocly/cli`
13
+
#' options](https://redocly.com/docs/cli/commands/lint#options) for more details.
55
14
#' @param verbose Logical that determines if a "is valid" statement is displayed. Defaults to `TRUE`
"--skip-rule", "no-empty-servers", # We don't know the end servers by default
48
+
"--skip-rule", "security-defined", # We don't know the security by default
49
+
"--skip-rule", "operation-summary", # operation summary values are optional. Not required
50
+
"--skip-rule", "operation-operationId-url-safe", # By default, it wants to have all operationId values be URL safe. This does not work with path parameters that want to use `{``}`.
51
+
"--skip-rule", "no-path-trailing-slash", # This is OK
82
52
tmpfile
83
53
),
84
54
stdout=TRUE,
85
55
stderr=TRUE
86
56
)
87
-
57
+
88
58
output<- paste0(output, collapse="\n")
89
59
90
-
# using expect_equal vs a regex test to have a better error message
91
-
is_equal<- sub(tmpfile, "", output, fixed=TRUE) ==" is valid"
`@serializer` | `Alias`[`Args list]`] | Some serializers accept arguments. See [serializers article](./rendering-output.html#serializers) and [serializers reference](https://www.rplumber.io/reference/serializers.html). Aliases : `r paste0("<code>", registered_serializers(), "</code>", collapse = ", ")` from [`registered_serializers()`](https://www.rplumber.io/reference/register_serializer.html).
74
74
`@parser` | `Alias``[Args list]` | Some parsers accept arguments. See [parsers reference](https://www.rplumber.io/reference/parsers.html). Can be repeated to allow multiple parsers on the same endpoint. Aliases : `r paste0("<code>", registered_parsers(), "</code>", collapse = ", ")` from [`registered_parsers()`](https://www.rplumber.io/reference/register_parser.html).
75
-
`@param` | `Name`[`:Type`(`*`) `Description`] | Enclose `Type` between square brackets `[]` to indicate it is an array. Adding an asterix indicates that the parameter is required. Can be repeated to define different parameters.
75
+
`@param` | `Name`[`:Type`(`*`) `Description`] | Enclose `Type` between square brackets `[]` to indicate it is an array. Adding an asterisk indicates that the parameter is required. Can be repeated to define different parameters.
76
76
`@response` | `Name``Description` | Simple [Response object](http://spec.openapis.org/oas/v3.0.3#response-object). Can be repeated to define different responses.
77
77
`@tag` | `Tag` | Can be repeated to add multiple tags. Quote with " or ' to use non word character (like spaces) in `Tag`. [Tag field](http://spec.openapis.org/oas/v3.0.3#operation-object)
78
78
`@preempt` | `Filter` | Specify that this endpoint has to execute before `Filter`. [Filters](./programmatic-usage.html#defining-filters)
0 commit comments