diff --git a/app/helpers/printExample.js b/app/helpers/printExample.js deleted file mode 100644 index 7bb6c2b..0000000 --- a/app/helpers/printExample.js +++ /dev/null @@ -1,10 +0,0 @@ -var Handlebars = require('handlebars'); -var common = require('../lib/common'); - -module.exports = function(value, options) { - var cloned = common.formatExample(value, options.data.root); - if (options.hash.type == 'array') - cloned = [cloned]; - var html = common.printSchema(cloned); - return new Handlebars.SafeString(html) -}; diff --git a/app/lib/common.js b/app/lib/common.js index 810fd31..610a859 100644 --- a/app/lib/common.js +++ b/app/lib/common.js @@ -67,47 +67,6 @@ var common = { return cloned; }, - formatExample: function(value, root) { - if (value.example) { - return value.example; - } - else if (value.schema && value.schema.$ref) { - return this.formatExampleProp(value.schema, root); - } - else if (value.schema && value.schema.items) { - return this.formatExampleProp(value.schema.items.$ref, root); - } - }, - - formatExampleProp: function(ref, root) { - var obj = {}; - var that = this; - - if (ref.$ref) { - ref = this.resolveSchemaReference(ref.$ref, root); - return this.formatExampleProp(ref, root); - } - else if (ref.type == 'object') { - Object.keys(ref.properties).forEach(function(k) { - obj[k] = that.formatExampleProp(ref.properties[k], root); - }); - } - else if (ref.type == 'array' && ref.items) { - obj = [ - this.formatExampleProp(ref.items, root), - this.formatExampleProp(ref.items, root), - ]; - } - else if (ref.example) { - return ref.example; - } - else { - return ref.type + (ref.format ? ' (' + ref.format + ')' : ''); - } - - return obj; - }, - printSchema: function(value) { if (!value) { return ''; diff --git a/app/views/partials/swagger/operation.hbs b/app/views/partials/swagger/operation.hbs index 94ac337..3a44fbc 100644 --- a/app/views/partials/swagger/operation.hbs +++ b/app/views/partials/swagger/operation.hbs @@ -68,7 +68,7 @@