@apielements/remote
v0.6.2
Published
API Elements adapter for performing actions via a remote API
Downloads
13
Readme
API Elements: Remote Adapter
This adapter provides support for parsing, validation and serialization via the API Elements Web Service in Fury.
The remote adapter can be configured to work with any API service compatible with API Blueprint API. By default the API Elements Web Service is used.
const defaultOptions = {
// the default value, but consumers should be able to override to use their own deployment
url: 'https://api.apielements.org',
parseEndpoint: '/parser',
validateEndpoint: '/validate',
serializeEndpoint: '/composer',
mediaTypes: {
// the collection of "parse", media types we want this
// instance of the adapter to handle.
// NOTE, this allows you to use the API for one media type but
// another local adapter for another.
parse: [
'text/vnd.apiblueprint',
'application/swagger+json',
'application/swagger+yaml',
'application/vnd.oai.openapi',
'application/vnd.oai.openapi+json',
],
validate: [
'text/vnd.apiblueprint',
'application/swagger+json',
'application/swagger+yaml',
'application/vnd.oai.openapi',
'application/vnd.oai.openapi+json',
],
// the collection of "serialize", media types we want this
// instance of the adapter to handle.
serialize: [
'text/vnd.apiblueprint',
],
}
};
Install
$ npm install @apielements/remote
Usage
const { Fury } = require('fury');
const FuryRemoteAdapter = require('@apielements/remote');
const fury = new Fury();
fury.use(new FuryRemoteAdapter(options);
fury.validate(...);
fury.parse(...);
fury.serialise(...);