ibm-openapi-support
Advanced tools
Comparing version 0.0.11 to 0.0.12
13
index.js
@@ -186,2 +186,3 @@ /* | ||
let resourceFormatter = formatters['resourceFormatter'] || function (route) { return route } | ||
let typeFormatter = formatters['typeFormatter'] || function (type) { return type } | ||
@@ -201,2 +202,3 @@ Object.keys(api.paths).forEach(function (path) { | ||
let params = [] | ||
let idtype | ||
// process the parameters | ||
@@ -223,2 +225,11 @@ if (api.paths[path][verb].parameters) { | ||
} | ||
// if there is a trailing id on the path, get its type from the parameters | ||
// section. | ||
let id = genutil.getIdName(path) | ||
if (id && parameter.in && parameter.in == 'path') { | ||
if (id === parameter.name) { | ||
idtype = typeFormatter(parameter.type) | ||
} | ||
} | ||
}) | ||
@@ -259,3 +270,3 @@ } | ||
// save the method, the path and associated parameters in the resources list. | ||
resources[resource].push({method: verb, route: pathFormatter(path), params: params, responses: resp}) | ||
resources[resource].push({method: verb, route: pathFormatter(path), params: params, responses: resp, idtype: idtype}) | ||
} | ||
@@ -262,0 +273,0 @@ }) |
{ | ||
"name": "ibm-openapi-support", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "utility for loading and parsing swagger", | ||
@@ -5,0 +5,0 @@ "author": { |
11
utils.js
@@ -36,2 +36,13 @@ /* | ||
exports.getIdName = function (ref) { | ||
// get the id name from the end of the path, if it exists. | ||
let name = ref.split('{').pop() | ||
if (name.endsWith('}')) { | ||
name = name.split('}')[0] | ||
} else { | ||
name = undefined | ||
} | ||
return name | ||
} | ||
exports.arrayContains = function (search, array) { | ||
@@ -38,0 +49,0 @@ // return true/false if search is/not found in array. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65507
899
1