diff --git a/src/api-viewer/APIViewer.js b/src/api-viewer/APIViewer.js index d9753b2..26a1c08 100644 --- a/src/api-viewer/APIViewer.js +++ b/src/api-viewer/APIViewer.js @@ -7,7 +7,7 @@ Ext.onReady(function() { 'name', 'type', 'typetext', 'description', 'verbose_description', 'enum', 'minimum', 'maximum', 'minLength', 'maxLength', 'pattern', 'title', 'requires', 'format', 'default', - 'disallow', 'extends', 'links', + 'disallow', 'extends', 'links', 'instance-types', { name: 'optional', type: 'boolean', @@ -214,6 +214,10 @@ Ext.onReady(function() { }, groupField: 'optional', sorters: [ + { + property: 'instance-types', + direction: 'ASC', + }, { property: 'name', direction: 'ASC', @@ -221,9 +225,27 @@ Ext.onReady(function() { ], }); + let has_type_properties = false; + Ext.Object.each(info.parameters.properties, function(name, pdef) { - pdef.name = name; - pstore.add(pdef); + if (pdef.oneOf) { + pdef.oneOf.forEach((alternative) => { + alternative.name = name; + pstore.add(alternative); + has_type_properties = true; + }); + } else if (pdef['instance-types']) { + pdef['instance-types'].forEach((type) => { + let typePdef = Ext.apply({}, pdef); + typePdef.name = name; + typePdef['instance-types'] = [type]; + pstore.add(typePdef); + has_type_properties = true; + }); + } else { + pdef.name = name; + pstore.add(pdef); + } }); pstore.sort(); @@ -255,6 +277,12 @@ Ext.onReady(function() { renderer: render_type, flex: 1, }, + { + header: 'For Types', + dataIndex: 'instance-types', + hidden: !has_type_properties, + flex: 1, + }, { header: 'Default', dataIndex: 'default',