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

swagger-snippet

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger-snippet - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

13

index.js

@@ -173,1 +173,14 @@ /**

}
// grab existing namespace object, or create a blank object
// if it doesn't exist
var SwaggerSnippet = window.SwaggerSnippet || {}
// define that object
SwaggerSnippet = {
getSwaggerSnippets: getSwaggerSnippets,
getEndpointSnippets: getEndpointSnippets
}
// replace/create the global namespace
window.SwaggerSnippet = SwaggerSnippet

9

package.json
{
"name": "swagger-snippet",
"version": "0.4.0",
"version": "0.4.1",
"description": "Generates code snippets for given Swagger / Open API Specification files",

@@ -19,3 +19,4 @@ "repository": {

"scripts": {
"test": "node test/test.js | tap-spec"
"test": "node test/test.js | tap-spec",
"build": "browserify index.js | uglifyjs -c > swaggersnippet.min.js"
},

@@ -26,5 +27,7 @@ "dependencies": {

"devDependencies": {
"browserify": "^13.1.0",
"tap-spec": "^4.1.1",
"tape": "^4.6.0"
"tape": "^4.6.0",
"uglifyify": "^3.0.3"
}
}

@@ -1,3 +0,3 @@

# swagger-snippet
Generates code snippets for given Swagger / Open API specification files.
# Swagger Snippet
**Generates code snippets for given Swagger / Open API specification files.**

@@ -11,4 +11,15 @@ This package takes as input a Swagger 2.0 / Open API specification. It translates the specification into an [HTTP Archive 1.2 request object](http://www.softwareishard.com/blog/har-12-spec/#request). It uses the [HTTP Snippet](https://github.com/Mashape/httpsnippet) library to generate code snippets for every API endpoint (URL path + HTTP method) defined in the specification in various languages & tools (`cURL`, `Node`, `Python`, `Ruby`, `Java`, `Go`, `C#`...).

## Build Swagger Snippet (for use in browser)
Clone the Swagger Snippet repository. Install required dependencies:
npm i
Build a minified version of Swagger Snippet (`swaggersnippet.min.js`):
npm run build
## Usage
### As a module
```javascript

@@ -32,4 +43,13 @@ let SwaggerSnippet = require('swagger-snippet')

### Within the browser
Include the `swaggersnippet.min.js` file created after building the the library (see above) in your HTML page:
<script type="text/javascript" src="path/to/swaggersnippet.min.js"></script>
Use Swagger Snippet, which now defines the global variable `SwaggerSnippet`.
## Output
The output for every endpoint is an object, containing the `method`, `url`, a human-readable `description`, and the corresponding `resource` - all of these values stem from the specification. In addition, within the `snippets` list, an object containing a code snippet for every chosen target is provided.
The output for every endpoint is an object, containing the `method`, `url`, a human-readable `description`, and the corresponding `resource` - all of these values stem from the specification. In addition, within the `snippets` list, an object containing a code snippet for every chosen target is provided. As of version `0.4.0`, the snippets include examplary payload data.

@@ -89,2 +109,2 @@ If `getSwaggerSnippets` is used, an array of the above described objects is returned.

License: MIT
License: MIT

Sorry, the diff of this file is not supported yet

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