openapi-to-md
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -122,4 +122,2 @@ #!/usr/bin/env node | ||
if (apiObject.type === "object") { | ||
output += outputRefComment(schemas, 0); | ||
output += outputComment(apiObject, 0); | ||
output += outputObject(apiDocument, undefined, apiObject); | ||
@@ -130,2 +128,5 @@ } | ||
} | ||
else { | ||
output += JSON.stringify(apiObject, undefined, " ") + "\n"; | ||
} | ||
} | ||
@@ -141,3 +142,8 @@ output += "```\n\n"; | ||
}; | ||
const outputComment = (apiObject, level) => { | ||
const outputComment = (refObject, apiObject, level) => { | ||
if (refObject) { | ||
const refName = getRefName(apiObject); | ||
if (refName) | ||
return SP(level) + `// ${refName}\n`; | ||
} | ||
return apiObject.description | ||
@@ -171,4 +177,3 @@ ? apiObject.description | ||
else if (apiObject.type === "object") { | ||
output += outputRefComment(schemas, nowLevel); | ||
output += outputComment(apiObject, nowLevel); | ||
output += outputComment(schemas, apiObject, nowLevel); | ||
output += name ? SP(nowLevel) + `${name}: {\n` : "{\n"; | ||
@@ -190,4 +195,3 @@ apiObject.properties && | ||
else if (apiObject.type) { | ||
output += outputRefComment(schemas, nowLevel); | ||
output += outputComment(apiObject, nowLevel); | ||
output += outputComment(schemas, apiObject, nowLevel); | ||
const type = Array.isArray(apiObject.type) | ||
@@ -203,4 +207,3 @@ ? apiObject.type | ||
else if (apiObject.anyOf) { | ||
output += outputRefComment(schemas, nowLevel); | ||
output += outputComment(apiObject, nowLevel); | ||
output += outputComment(schemas, apiObject, nowLevel); | ||
output += SP(nowLevel) + `${name}${required === true ? "" : "?"}: `; | ||
@@ -214,4 +217,3 @@ apiObject.anyOf.forEach((obj, index) => { | ||
else if (apiObject.allOf) { | ||
output += outputRefComment(schemas, nowLevel); | ||
output += outputComment(apiObject, nowLevel); | ||
output += outputComment(schemas, apiObject, nowLevel); | ||
output += SP(nowLevel) + `${name}${required === true ? "" : "?"}: `; | ||
@@ -225,4 +227,3 @@ apiObject.allOf.forEach((obj, index) => { | ||
else if (apiObject.oneOf) { | ||
output += outputRefComment(schemas, nowLevel); | ||
output += outputComment(apiObject, nowLevel); | ||
output += outputComment(schemas, apiObject, nowLevel); | ||
output += SP(nowLevel) + `${name}${required === true ? "" : "?"}: `; | ||
@@ -229,0 +230,0 @@ apiObject.oneOf.forEach((obj, index) => { |
{ | ||
"name": "openapi-to-md", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "bin": { |
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
356
14645