mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-11 03:16:48 +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._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}>`;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user