openapi-snippet
Advanced tools
Comparing version 0.9.0 to 0.9.1
@@ -43,3 +43,3 @@ /** | ||
method: method.toUpperCase(), | ||
url: baseUrl + getFullPath(openApi, path), | ||
url: baseUrl + getFullPath(openApi, path, method), | ||
headers: getHeadersArray(openApi, path, method), | ||
@@ -89,2 +89,7 @@ queryString: getQueryStrings(openApi, path, method, queryParamValues), | ||
} | ||
if (openApi.paths[path][method].requestBody && openApi.paths[path][method].requestBody['$ref']) { | ||
openApi.paths[path][method].requestBody = resolveRef(openApi, openApi.paths[path][method].requestBody['$ref']); | ||
} | ||
if (openApi.paths[path][method].requestBody && openApi.paths[path][method].requestBody.content && | ||
@@ -186,10 +191,12 @@ openApi.paths[path][method].requestBody.content['application/json'] && | ||
* @param {string} path Key of the path | ||
* @param {string} method Key of the method | ||
* @return {string} Full path including example values | ||
*/ | ||
const getFullPath = function (openApi, path) { | ||
const getFullPath = function (openApi, path, method) { | ||
let fullPath = path | ||
const parameters = openApi.paths[path].parameters || openApi.paths[path][method].parameters; | ||
if (typeof openApi.paths[path].parameters !== 'undefined') { | ||
for (let i in openApi.paths[path].parameters) { | ||
let param = openApi.paths[path].parameters[i] | ||
if (typeof parameters !== 'undefined') { | ||
for (let i in parameters) { | ||
let param = parameters[i] | ||
if (typeof param['$ref'] === 'string' && | ||
@@ -196,0 +203,0 @@ /^#/.test(param['$ref'])) { |
{ | ||
"name": "openapi-snippet", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "Generates code snippets from Open API (previously Swagger) documents.", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
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
1196306
40748