https://github.com/meztez/redoc
A collection of 'HTML', 'JavaScript', 'CSS' and fonts assets that generate 'Redoc' documentation from an OAS compliant API.
https://github.com/meztez/redoc
Last synced: 4 months ago
JSON representation
A collection of 'HTML', 'JavaScript', 'CSS' and fonts assets that generate 'Redoc' documentation from an OAS compliant API.
- Host: GitHub
- URL: https://github.com/meztez/redoc
- Owner: meztez
- License: other
- Created: 2020-05-17T22:50:51.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-11-17T18:59:41.000Z (over 1 year ago)
- Last Synced: 2024-04-25T05:40:55.947Z (10 months ago)
- Language: R
- Size: 1.87 MB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - meztez/redoc - A collection of 'HTML', 'JavaScript', 'CSS' and fonts assets that generate 'Redoc' documentation from an OAS compliant API. (R)
README
---
title: "Generates `Redoc` documentation from an OAS Compliant API"
output:
github_document:
fig_width: 9
fig_height: 5
---[](https://cran.r-project.org/package=redoc)
[](https://github.com/meztez/redoc/actions)
[](https://community.rstudio.com/tag/plumber)`redoc` is a collection of `HTML`, `JavaScript`, `CSS` and fonts assets that generate `Redoc` documentation from an OpenAPI Specification.
The main purpose of this package is to enable package authors to create APIs that are compatible with [redoc.ly](https://redocly.com/redoc/) and [openapis.org](https://www.openapis.org/).
Package authors providing web interfaces can serve the static files from `redoc_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(redoc)
browseURL(redoc_index())
```
## Installation
```r
remotes::install_github("https://github.com/meztez/redoc")
```## Use with `plumber` R package
### `plumber` annotation syntax
```r
library(redoc)#* @plumber
function(pr) {
pr$setDocs("redoc", theme = list(menu = list(backgroundColor = "#00DE9C")))
}#* @get /hello
function() {
"hello"
}
```### `plumber` programmatic usage
```r
library(plumber)
library(redoc)
pr() %>%
pr_get("hello", function() {"hello"}) %>%
pr_set_docs("redoc", theme = list(menu = list(backgroundColor = "#00DE9C"))) %>%
pr_run()```
### Using `Redoc` API attributes
Further customize `Redoc` using its configuration object. Use nested named list for nested configuration options.
```r
pr()$setDocs("redoc", theme = list(menu = list(backgroundColor = "#00DE9C")), disableSearch = TRUE)pr() %>% pr_set_docs("rapidoc", theme = list(menu = list(backgroundColor = "#00DE9C")), disableSearch = TRUE)
```The full set of `Redoc` configuration options is supported.
To learn more about `Redoc` visit:
* [Redoc](https://redocly.com/redoc/)
* [Redoc configuration options](https://github.com/Redocly/redoc#redoc-options-object)