https://github.com/meztez/rapidoc
RapiDoc UI integration for R
https://github.com/meztez/rapidoc
Last synced: 4 months ago
JSON representation
RapiDoc UI integration for R
- Host: GitHub
- URL: https://github.com/meztez/rapidoc
- Owner: meztez
- License: other
- Created: 2020-06-27T13:56:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-17T18:56:34.000Z (over 1 year ago)
- Last Synced: 2024-11-01T02:23:05.515Z (4 months ago)
- Language: R
- Size: 1.8 MB
- Stars: 14
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - meztez/rapidoc - RapiDoc UI integration for R (R)
README
---
title: "Generates `RapiDoc` documentation from an OAS Compliant API"
output:
github_document:
fig_width: 9
fig_height: 5
---[](https://cran.r-project.org/package=rapidoc)
[](https://github.com/meztez/rapidoc/actions)
[](https://community.rstudio.com/tag/plumber)`rapidoc` is a collection of `HTML`, `JavaScript`, `CSS` and fonts assets that generate `RapiDoc` documentation from an OpenAPI Specification.
The main purpose of this package is to enable package authors to create APIs that are compatible with [RapiDoc](https://mrin9.github.io/RapiDoc/) and [openapis.org](https://www.openapis.org/).
Package authors providing web interfaces can serve the static files from `rapidoc_path()` using [httpuv](https://github.com/rstudio/httpuv) or [fiery](https://github.com/thomasp85/fiery). As a start, we can also browse them by running
```{r eval=FALSE}
library(rapidoc)
browseURL(rapidoc_index())
```
## Installation
```r
remotes::install_github("https://github.com/meztez/rapidoc")
```## Use with `plumber` R package
### `plumber` annotation syntax
```r
library(rapidoc)#* @plumber
function(pr) {
pr$setDocs("rapidoc", bg_color = "#00DE9C")
}#* @get /hello
function() {
"hello"
}
```### `plumber` programmatic usage
```r
library(plumber)
library(rapidoc)
pr() %>%
pr_get("hello", function() {"hello"}) %>%
pr_set_docs("rapidoc", bg_color = "#00DE9C") %>%
pr_run()```
### Using `RapiDoc` API attributes
Further customize `RapiDoc` using its API attributes. Use underscores instead of hyphens. R boolean values are converted.
```r
pr()$setDocs("rapidoc", bg_color = "#F5F", show_info = FALSE)pr() %>% pr_set_docs("rapidoc", bg_color = "#F5F", show_info = FALSE)
```The full set of `RapiDoc` API attributes is supported.
To learn more about `RapiDoc` visit:
* [RapiDoc](https://mrin9.github.io/RapiDoc/)
* [RapiDoc API attributes reference](https://mrin9.github.io/RapiDoc/api.html)