Skip to contents

Builds a complete client package, petstoretrial, for all 19 operations of the Swagger Petstore. It uses the frozen Petstore schema shipped with specmill and the reviewed configuration in system.file('examples', 'petstore', package = 'specmill'): three service files (pet.yml, store.yml, user.yml) that rename functions and parameters, group generated source and help, and map array query and header inputs, plus six client-owned functions and a localhost test of every endpoint. Nothing is downloaded and no request is sent.

Usage

petstore_example(path)

Arguments

path

Directory for the new client package. It must not exist.

Value

The generate_client() result for the configured client, invisibly.

Details

The client is initialized from the frozen schema, its project YAML is replaced by the three example services, and wrappers and help are generated. The six client-owned functions are documented with roxygen2 in a temporary copy, and only their help pages are copied back, so the generated pages stay owned by specmill. Run the client's tests with testthat::test_local(path); they need callr and httpuv.

See also

The example's README: system.file('examples', 'petstore', 'README.md', package = 'specmill').

Examples

if (FALSE) { # \dontrun{
root <- file.path(tempdir(), 'petstoretrial')
petstore_example(root)
testthat::test_local(root)
} # }