Socket
Socket
Sign inDemoInstall

openapi-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

openapi-snippet - npm Package Compare versions

Comparing version 0.8.1 to 0.9.0

31

openapi-to-har.js

@@ -43,3 +43,3 @@ /**

method: method.toUpperCase(),
url: baseUrl + path,
url: baseUrl + getFullPath(openApi, path),
headers: getHeadersArray(openApi, path, method),

@@ -181,2 +181,29 @@ queryString: getQueryStrings(openApi, path, method, queryParamValues),

/**
* Return the path with the parameters example values used if specified.
*
* @param {Object} openApi OpenApi document
* @param {string} path Key of the path
* @return {string} Full path including example values
*/
const getFullPath = function (openApi, path) {
let fullPath = path
if (typeof openApi.paths[path].parameters !== 'undefined') {
for (let i in openApi.paths[path].parameters) {
let param = openApi.paths[path].parameters[i]
if (typeof param['$ref'] === 'string' &&
/^#/.test(param['$ref'])) {
param = resolveRef(openApi, param['$ref'])
}
if (typeof param.in !== 'undefined' && param.in.toLowerCase() === 'path') {
if (typeof param.example !== 'undefined') { // only if the schema has an example value
fullPath = fullPath.replace("{" + param.name + "}", param.example)
}
}
}
}
return fullPath
}
/**
* Get an array of objects describing the header for a path and method pair

@@ -288,3 +315,3 @@ * described in the given OpenAPI document.

if(authType !== 'apikey'){
if(authType !== 'apikey' && authType !== 'oauth2'){
authScheme = secDefinition.scheme.toLowerCase();

@@ -291,0 +318,0 @@ }

2

package.json
{
"name": "openapi-snippet",
"version": "0.8.1",
"version": "0.9.0",
"description": "Generates code snippets from Open API (previously Swagger) documents.",

@@ -5,0 +5,0 @@ "repository": {

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