Skip to content

Latest commit

 

History

History
86 lines (63 loc) · 2.19 KB

README.md

File metadata and controls

86 lines (63 loc) · 2.19 KB

Generates RapiDoc documentation from an OAS Compliant API

CRAN_Status_Badge R build status RStudio community

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 and openapis.org.

Package authors providing web interfaces can serve the static files from rapidoc_path() using httpuv or fiery. As a start, we can also browse them by running

library(rapidoc)
browseURL(rapidoc_index())

Installation

remotes::install_github("https://github.com/meztez/rapidoc")

Use with plumber R package

plumber annotation syntax

library(rapidoc)

#* @plumber
function(pr) {
  pr$setDocs("rapidoc", bg_color = "#00DE9C")
}

#* @get /hello
function() {
  "hello"
}

plumber programmatic usage

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.

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: