Skip to contents

The OpenAPI standard offers a way to describe the various endpoints of your api in machine- and human-readable way. On top of this, various solutions have been build to generate online documentation of the API based on a provided OpenAPI spec. plumber2 offers support for RapiDoc, Redoc, and Swagger as a UI frontend for the documentation and will also generate the spec for you based on the tags in parsed files. If you are creating your API programmatically or you wish to add to the autogenerated docs you can add docs manually, either when adding a handler (using the doc argument), or with the api_doc_add() function

Usage

api_doc_setting(api, doc_type, doc_path)

api_doc_add(api, doc, overwrite = FALSE, subset = NULL)

Arguments

api

A plumber2 api object to add docs or doc settings to

doc_type

The type of API documentation to generate. Can be either "rapidoc" (the default), "redoc", "swagger", or NULL (equating to not generating API docs)

doc_path

The URL path to serve the api documentation from

doc

A list with the OpenAPI documentation

overwrite

Logical. Should already existing documentation be removed or should it be merged together with doc

subset

A character vector giving the path to the subset of the docs to assign doc to

Value

These functions return the api object allowing for easy chaining with the pipe