Skip to content

Given a url to a swagger api-docs spec, loads it and all related resource declarations as one JSON object.

Notifications You must be signed in to change notification settings

caciviclab/fetch-swagger-schema

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fetch Swagger Schema

Given a url to a swagger api-docs spec, loads it and all related resource declarations into one JSON object. The Resource API Declartion JSON objects are added as a 'apiDeclaration' property to each api object in the resource listing.

CLI Usage

npm install -g fetch-swagger-schema

# Fetch and save schema as a json file
fetch-swagger-schema http://petstore.swagger.io/api/api-docs petstore.json

# Fetch and output response to stdout
fetch-swagger-schema http://petstore.swagger.io/api/api-docs

Library Usage

First install the package with npm install fetch-swagger-schema, then in your script:

var fetchSchema = require('fetch-swagger-schema');

fetchSchema('http://petstore.swagger.io/api/api-docs', function(error, schema){
   if(error) return console.error(error);
   console.log('Schema:', schema); 
});

About

Given a url to a swagger api-docs spec, loads it and all related resource declarations as one JSON object.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%