Skip to content

mihaislobozeanu/node-request-by-swagger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Request by Swagger

The library constructs request options object, based on Swagger schema endpoint.

Objectives

Using REST one has to deal with many delivering data options: GET query, headers, body json, body multipart. All of these options can be described using Swagger schema parameters section. This library is an attempt to separate request logic from HTTP implementation details. So you can consider you endpoint as a function, that takes some arguments

Install

npm i --save node-request-by-swagger

Usage

const getRequestOptions = require('node-request-by-swagger');
const options = getRequestOptions(schema['/pet'].post, {
    method: 'post',
    baseUrl: `http://${schema.host}${schema.basePath}`,
    path: '/pet',
    args: {
        body: {
            name: 'bob'
        }
    },
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • JavaScript 100.0%