diff --git a/lib/components/JsonSchema/json-schema.js b/lib/components/JsonSchema/json-schema.js index ce42f923..02b7940c 100644 --- a/lib/components/JsonSchema/json-schema.js +++ b/lib/components/JsonSchema/json-schema.js @@ -108,15 +108,18 @@ export default class JsonSchema extends BaseComponent { propData.format = itemFormat; propData._isArray = true; propData.type = 'array ' + propData.items.type; - } - - if (propData.type === 'object') { + } else if (propData.type === 'object') { propData._displayType = propData.title || 'object'; - } - - if (!propData.type) { + } else if (!propData.type) { propData._displayType = '< * >'; propData._displayTypeHint = 'This field may contain data of any type'; + } else { + // here we are sure that property has simple type + // delete pointer for simple types to not show it as subschema + if (propData._pointer) { + propData._pointer = undefined; + propData._displayType = propData.title ? `${propData.title} (${propData.type})` : propData.type; + } } if (propData.format) propData._displayFormat = `<${propData.format}>`; diff --git a/lib/components/ParamsList/params-list.js b/lib/components/ParamsList/params-list.js index 1a053b5b..957d18b4 100644 --- a/lib/components/ParamsList/params-list.js +++ b/lib/components/ParamsList/params-list.js @@ -26,6 +26,7 @@ export default class ParamsList extends BaseComponent { paramsList = paramsList.map((paramData) => { let propPointer = paramData._pointer; + if (paramData.in === 'body') return paramData; return JsonSchema.injectPropData(paramData, paramData.name, propPointer); }); @@ -35,7 +36,7 @@ export default class ParamsList extends BaseComponent { let bodyParam = paramsMap.body[0]; bodyParam.pointer = bodyParam._pointer; this.data.bodyParam = bodyParam; - delete paramsMap.body; + paramsMap.body = undefined; } this.data.noParams = !(Object.keys(paramsMap).length || this.data.bodyParam);