From: Thomas Lamprecht Date: Wed, 21 Mar 2018 14:53:38 +0000 (+0100) Subject: api-viewer: show full return info if available X-Git-Url: https://git.proxmox.com/?p=pve-docs.git;a=commitdiff_plain;h=69c4b95624416b4caef349b169493c4ffa14a90c api-viewer: show full return info if available if we have extended information available about what a API call returns the show it. Just stringify the items and/or properties object and put it in
tags.

Signed-off-by: Thomas Lamprecht 
---

diff --git a/api-viewer/PVEAPI.js b/api-viewer/PVEAPI.js
index 409214d..a167b4c 100644
--- a/api-viewer/PVEAPI.js
+++ b/api-viewer/PVEAPI.js
@@ -189,14 +189,26 @@ Ext.onReady(function() {
 
 		if (info.returns) {
 
-		    var rtype = info.returns.type;
-		    if (!rtype && info.returns.items)
+		    var retinf = info.returns;
+		    var rtype = retinf.type;
+		    if (!rtype && retinf.items)
 			rtype = 'array';
 		    if (!rtype)
 			rtype = 'object';
 
+		    var returnhtml;
+		    if (retinf.items) {
+			returnhtml = '
items: ' + JSON.stringify(retinf.items, null, 4) + '
'; + } + + if (retinf.properties) { + returnhtml = returnhtml || ''; + returnhtml += '
properties:' + JSON.stringify(retinf.properties, null, 4);
+		    }
+
 		    sections.push({
-			title: 'Returns: ' + rtype
+			title: 'Returns: ' + rtype,
+			html: returnhtml
 		    });
 		}