0.9.1 • Published 9 years ago

openapi-exec v0.9.1

Weekly downloads
14
License
MIT
Repository
github
Last release
9 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

9 years ago

0.9.0

9 years ago

0.8.8

10 years ago

0.8.7

10 years ago

0.8.6

10 years ago

0.8.5

10 years ago

0.8.4

10 years ago

0.8.3

10 years ago

0.8.2

10 years ago

0.8.0

10 years ago

0.0.1

10 years ago