[pve-devel] [PATCH docs 2/2] print object format as JSON
Dominik Csapak
d.csapak at proxmox.com
Fri Sep 2 12:50:39 CEST 2016
this prints an parameter as JSON
if it is an object.
this is far from perfect, but better than
[object Object]
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
api-viewer/PVEAPI.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/api-viewer/PVEAPI.js b/api-viewer/PVEAPI.js
index a27d6c4..162d006 100644
--- a/api-viewer/PVEAPI.js
+++ b/api-viewer/PVEAPI.js
@@ -67,8 +67,12 @@ Ext.onReady(function() {
if (pdef['enum'])
return pdef['enum'].join(' | ');
- if (pdef.format)
+ if (pdef.format && typeof pdef.format !== 'object') {
return pdef.format;
+ } else if (pdef.format) {
+ metaData.style = 'white-space:pre;';
+ return JSON.stringify(pdef.format, null, 2);
+ }
if (pdef.pattern)
return pdef.pattern;
--
2.1.4
More information about the pve-devel
mailing list