FAQ
Does this support YAML definitions?
Yes! YAML definitions will be automatically converted to JSON when they're fetched.
Does this support Swagger 2.0 definitions?
At the moment it does not. If you wish to use an API that has a Swagger 2.0 file, you'll need to first convert it to an OpenAPI 3 definition.
Does this support OpenAPI 3.1 definitions?
Yes!
Does this support OpenAPI 4 (Moonwalk) definitions?
No! Since v4 is still in the early planning stages we don't support it but once it's finalized we will.
Does this support traditional OAuth 2 flows of creating tokens?
Not yet, unfortunately. For APIs that use OAuth 2, you'll need a fully-qualified token already for api
to make requests.
Does this support APIs that use multiple forms of authentication on a single request?
Not yet! This is something we're thinking about how to handle, but it's difficult with the simplified nature of the .auth()
method as it by design does not ask the user to inform the SDK of what kind of authentication scheme the token they're supplying it should match up against.
If you have ideas on how to handle this we'd love to hear them.
Will this work in browsers?
Yes! However because api
supports multipart/form-data
requests and uploading files to APIs you may need to polyfill the fs
module in your toolchain. If you're having trouble getting autogenerated SDKs working in a browser please let us know!
Will this validate my data before it reaches the API?
Not yet! This is something we're thinking about in the future.
Does this support fetching OpenAPI definitions that require authentication to download?
Not yet! The URL that you give the module must be publicly accessible. If it isn't, you can download it to your computer or server and then use the absolute path to that file instead.
$ npx api install ./path/to/downloaded.json
const sdk = require('api')('./path/to/downloaded.json');
Where is the cache stored?
See How does it work? for some information on how, when, and where api
caches its data.
Updated about 1 year ago