mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-11 03:16:48 +03:00
JsonSchema: display object without properties as a simple type
This commit is contained in:
parent
da5224e3e2
commit
9860e31049
|
@ -63,13 +63,6 @@ export default class JsonSchema extends BaseComponent {
|
|||
this.componentSchema.required.forEach(prop => this.requiredMap[prop] = true);
|
||||
}
|
||||
|
||||
if (!schema.properties) {
|
||||
this.isTrivial = true;
|
||||
this._displayType = schema.type;
|
||||
this._displayTypeHint = 'This field may contain data of any type';
|
||||
return;
|
||||
}
|
||||
|
||||
let discriminatorFieldIdx = -1;
|
||||
let props = Object.keys(schema.properties).map((prop, idx) => {
|
||||
let propData = schema.properties[prop];
|
||||
|
@ -108,13 +101,13 @@ export default class JsonSchema extends BaseComponent {
|
|||
propData.format = itemFormat;
|
||||
propData._isArray = true;
|
||||
propData.type = 'array ' + propData.items.type;
|
||||
} else if (propData.type === 'object') {
|
||||
} else if (propData.type === 'object' && propData.properties) {
|
||||
propData._displayType = propData.title || 'object';
|
||||
} 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
|
||||
// here we are sure that property has simple type (integer, string, object withou properties)
|
||||
// delete pointer for simple types to not show it as subschema
|
||||
if (propData._pointer) {
|
||||
propData._pointer = undefined;
|
||||
|
|
Loading…
Reference in New Issue
Block a user