0.9.1 • Published 8 years ago

openapi-exec v0.9.1

Weekly downloads
14
License
MIT
Repository
github
Last release
8 years ago

openapi-node

OpenAPI executer for Nodejs

js-standard-style Codeship Status for blockenio/openapi-node codecov.io

Installation

Install using npm:

npm i openapi-exec

Example

Execute official example with node-fetch

const load = require('js-yaml').safeLoad
const fetch = require('node-fetch')
const OpenAPI = require('openapi-exec')

fetch('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/yaml/uber.yaml')
  .then((res) => res.text())
  .then((yaml) => load(yaml))
  .then((schema) => OpenAPI.createWithResolve(schema))
  .then((client) => {
    client.setCredentials('apiKey', { server_token: 'xxxxxxxxxxxxxxxxx' })
    return client.operate('/products', 'get', {
      latitude: 35.681382,
      longitude: 139.7638953,
    })
  })
  .then((res) => res.json())
  .then((json) => console.log('OK:', json))
  .catch((e) => console.error(e.stack))

Contributing

This repository uses JavaScript Standard Style.
Please check format & test compatibility.

  1. Fork this repo
  2. Create topic branch
  3. Run npm test
  4. Make pull request
0.9.1

8 years ago

0.9.0

8 years ago

0.8.8

8 years ago

0.8.7

8 years ago

0.8.6

8 years ago

0.8.5

8 years ago

0.8.4

8 years ago

0.8.3

8 years ago

0.8.2

8 years ago

0.8.0

8 years ago

0.0.1

8 years ago