mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-13 12:26:34 +03:00
Fix treating refereced schemas with simple types (string, integer) as nested
This commit is contained in:
parent
3f698caabe
commit
0a8440f44b
|
@ -108,15 +108,18 @@ export default class JsonSchema extends BaseComponent {
|
||||||
propData.format = itemFormat;
|
propData.format = itemFormat;
|
||||||
propData._isArray = true;
|
propData._isArray = true;
|
||||||
propData.type = 'array ' + propData.items.type;
|
propData.type = 'array ' + propData.items.type;
|
||||||
}
|
} else if (propData.type === 'object') {
|
||||||
|
|
||||||
if (propData.type === 'object') {
|
|
||||||
propData._displayType = propData.title || 'object';
|
propData._displayType = propData.title || 'object';
|
||||||
}
|
} else if (!propData.type) {
|
||||||
|
|
||||||
if (!propData.type) {
|
|
||||||
propData._displayType = '< * >';
|
propData._displayType = '< * >';
|
||||||
propData._displayTypeHint = 'This field may contain data of any type';
|
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}>`;
|
if (propData.format) propData._displayFormat = `<${propData.format}>`;
|
||||||
|
|
|
@ -26,6 +26,7 @@ export default class ParamsList extends BaseComponent {
|
||||||
|
|
||||||
paramsList = paramsList.map((paramData) => {
|
paramsList = paramsList.map((paramData) => {
|
||||||
let propPointer = paramData._pointer;
|
let propPointer = paramData._pointer;
|
||||||
|
if (paramData.in === 'body') return paramData;
|
||||||
return JsonSchema.injectPropData(paramData, paramData.name, propPointer);
|
return JsonSchema.injectPropData(paramData, paramData.name, propPointer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ export default class ParamsList extends BaseComponent {
|
||||||
let bodyParam = paramsMap.body[0];
|
let bodyParam = paramsMap.body[0];
|
||||||
bodyParam.pointer = bodyParam._pointer;
|
bodyParam.pointer = bodyParam._pointer;
|
||||||
this.data.bodyParam = bodyParam;
|
this.data.bodyParam = bodyParam;
|
||||||
delete paramsMap.body;
|
paramsMap.body = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.data.noParams = !(Object.keys(paramsMap).length || this.data.bodyParam);
|
this.data.noParams = !(Object.keys(paramsMap).length || this.data.bodyParam);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user