diff --git a/handlebars/helpers.js b/handlebars/helpers.js index efa0a92..6740061 100644 --- a/handlebars/helpers.js +++ b/handlebars/helpers.js @@ -101,5 +101,16 @@ function dataType (value) { if (value.type === 'array') { return dataType(value.items || {}) + '[]' } + if (Array.isArray(value.type)) { + var types = '' + value.type.forEach(function (element) { + var subType = {} + subType.type = element + subType.items = value.items || {} + if (types) types += '|' + types += dataType(subType) + }) + if (types) return types + } return value.type } diff --git a/handlebars/partials/json-schema/body.hbs b/handlebars/partials/json-schema/body.hbs index c71356c..6d18e8c 100644 --- a/handlebars/partials/json-schema/body.hbs +++ b/handlebars/partials/json-schema/body.hbs @@ -18,11 +18,11 @@ {{#ifeq type 'object'}} {{>json-schema/type-object}} {{else}} - {{#ifeq type 'array'}} + {{#ifcontains type 'array'}} {{#if items}} {{>json-schema/array-items items}} {{/if}} - {{/ifeq}} + {{/ifcontains}} {{/ifeq}} {{else}} {{>json-schema/type-object}}