Package 'swagger'

Title: Dynamically Generates Documentation from a 'Swagger' Compliant API
Description: A collection of 'HTML', 'JavaScript', and 'CSS' assets that dynamically generate beautiful documentation from a 'Swagger' compliant API: <https://swagger.io/specification/>.
Authors: Barret Schloerke [aut] , Javier Luraschi [aut], Bruno Tremblay [cre, ctb], RStudio [cph], SmartBear Software [aut, cph]
Maintainer: Bruno Tremblay <[email protected]>
License: Apache License 2.0 | file LICENSE
Version: 5.17.14.1
Built: 2024-09-21 05:53:34 UTC
Source: https://github.com/rstudio/swagger

Help Index


swagger: Dynamically Generates Documentation from a Swagger-Compliant API

Description

Swagger is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.

Details

The main purpose of this package is to enable package authors to create APIs that are compatible with https://swagger.io/ and https://www.openapis.org/.

To learn more about Swagger visit: https://swagger.io/swagger-ui/

Author(s)

Maintainer: Bruno Tremblay [email protected] [contributor]

Authors:

Other contributors:

  • RStudio [copyright holder]

See Also

Useful links:


Path to Swagger Index

Description

Retrieves the path to the swagger index file.

Usage

swagger_index(version = "5")

Arguments

version

Major version number to be used for Swagger UI. Currently version "3" is compatible with OpenAPI spec 2.0, 3.0.

Examples

if (interactive()) {
  browseURL(swagger_index())
} else {
  print(paste("You can use swagger under: ", swagger_index()))
}

Path to Swagger Resources

Description

Retrieves the path to swagger resources.

Usage

swagger_path(version = "5")

Arguments

version

Major version number to be used for Swagger UI. Currently version "3" is compatible with OpenAPI spec 2.0, 3.0.

Examples

if (interactive()) {
  browseURL(swagger_path())
} else {
  print(paste("You can explore swagger resources under: ", swagger_path()))
}

Swagger Index File with OpenAPI Path

Description

Produces the content for a index.html file that will attempt to access a provided API path.

Usage

swagger_spec(
  api_path = "\"http://petstore.swagger.io/v2/swagger.json\"",
  version = "5"
)

Arguments

api_path

Path to paste into the an OpenAPI specification file

version

Major version number to be used for Swagger UI. Currently version "3" is compatible with OpenAPI spec 2.0, 3.0.

Value

large string containing the contents of swagger_index() with the appropriate specification path changed to the api_path value.

Examples

if (interactive()) {
  swagger_spec("https://developer.uspto.gov/ibd-api/swagger.json")
}