@aerofer/sdk-core

SDK Generator for APIs

Usage no npm install needed!

<script type="module">
  import aeroferSdkCore from 'https://cdn.skypack.dev/@aerofer/sdk-core';
</script>

README

Logo

Core SDK Generator

This package is not the JS SDK. It is only a skeleton generator for both our public & internal SDKs, containing shared modules and functionality.

This generator makes use of the swagger-client library to synchronously produce an SDK from an Open API Specification when the library is required.

As the SDK generates the operations synchronously, the specification file must be bundled and fully resolved when the package is published (not loaded remotely).

The specification file must be fully resolved, and therefore not include any $ref values, remote or local.

Getting Started

core(spec, [includes], [options])

You can initialize this library against any valid OpenAPI 2.0 Specification object, demonstrated below.

const core = require('@aerofer/sdk-core');

const spec = require('./spec.json');

module.exports = core(spec);

spec

A parsed Javascript object of the OpenAPI 2.0 Specification.

includes (Default: {})

Uses the deepmerge library to deeply merge any object into the API after it has been initialized.

Options

mergeOptions (Default: {})

The options to be applied when merging any includes with the initialized API object.