Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swagger-tools

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger-tools

Various tools for using and integrating with Swagger.

  • 0.1.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
57K
decreased by-34.7%
Maintainers
1
Weekly downloads
 
Created
Source

The project provides various tools for integrating and interacting with Swagger. This project is in its infancy but what is within the repository should be fully tested and reusable. Please visit the issue tracker to see what issues we are aware of and what features/enhancements we are working on.

Supported Swagger Versions

  • 1.2

Features

  • Schema validation: For the file(s) supported by the Swagger specification, ensure they pass structural validation based on the JSON Schema associated with that version of the specification

Installation

swagger-tools is distributed via NPM so installation is the usual: npm install swagger-tools --save

Usage

The swagger-tools module currently exposes one property: v1_2. This is a reference to an object that has the following structure:

  • docsUrl: This is a link to the Swagger documentation for the corresponding specification version
  • schemasUrl: This is a link to the Swagger JSON Schema files for the corresponding specification version
  • verison: This is the Swagger specification version
  • schemas: This is an object where the keys are the Swagger JSON Schema file names and the object is the loaded schema contents
  • validate: This is a function used to validate a Swagger document, as a JavaScript object, against a Swagger schema file

Here is an example showing how to use both versions of the validate function (For more details, the sources are documented):

var spec = require('swagger-tools').v1_2;
var petJson = require('./samples/1.2/pet.json');
var rlJson = require('./samples/1.2/resource-listing.json');
var petResults = spec.validate(petJson); // The default schema used is 'apiDeclaration.json'
var rlResults = spec.validate(rlJson, 'resourceListing.json');

Contributing

This project uses Gulp for building so npm install -g gulp once you clone this project. Running gulp in the project root will lint check the source code and run the unit tests.

Keywords

FAQs

Package last updated on 02 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc