rapiclient
rapiclient copied to clipboard
Small increments for some openapi3 support
I've been using rapiclient against some internal authenticated REST api's recently.
These APIs have necessitated a few small changes:
- allow the JSON to have
openapi
instead ofswagger
(was only a warning anyway) - allow parameter definitions to come from
^#/components
as well as^#/definitions
- allow the
config
andheaders
to be callback functions rather than fixed objects
These changes still need a little documentation added (and maybe make them less verbose in their messaging too)
Are you interested in these? If you are then, I'll happily update the docs and tidy up this PR. If not, then no problem - we can run off a fork of this library - assuming that's OK with the license (currently it's not entirely obvious which open source model this is licensed under)
Thanks for all your work on this - it's a very useful library :)
small fixes made today - especially around using servers
for an openapi api
example use is:
devtools::load_all()
lovecraft <- get_api("https://randomlovecraft.com/openapi.yaml")
lovecraft_operations <- get_operations(lovecraft)
books <- lovecraft_operations$`get-books`()
books_content <- httr::content(books)
sentences <- lovecraft_operations$`get-sentences`()
sentences_content <- httr::content(sentences)
specific_sentence <- lovecraft_operations$`get-specific-sentence`(id = "74c1cd53")
specific_sentence_content <- httr::content(specific_sentence)
book_sentences <- lovecraft_operations$`get-sentences-from-book`(id = "1cb2", limit = 5)
book_sentences_content <- httr::content(book_sentences)
This obviously isn't complete (openapi has lots more in it) but at least allows openapi descriptions to be accessed.