mirror of
https://github.com/Redocly/redoc.git
synced 2025-01-30 17:44:07 +03:00
JsonSchema treat array of objects
This commit is contained in:
parent
54b3ef1223
commit
af4f21726a
5435
demo/rebilly.json
Normal file
5435
demo/rebilly.json
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
import {JsonPointer} from '../../utils/JsonPointer';
|
||||
import {RedocComponent, BaseComponent} from '../base';
|
||||
import {ElementRef} from 'angular2/angular2';
|
||||
|
||||
|
@ -29,11 +28,12 @@ export default class JsonSchema extends BaseComponent {
|
|||
// TODO
|
||||
return;
|
||||
}
|
||||
if (!schema.properties) return;
|
||||
let props = Object.keys(schema.properties).map(prop => {
|
||||
let propData = schema.properties[prop];
|
||||
this.injectPropData(prop, propData);
|
||||
return propData;
|
||||
})
|
||||
});
|
||||
this.data.properties = props;
|
||||
|
||||
|
||||
|
@ -55,12 +55,15 @@ export default class JsonSchema extends BaseComponent {
|
|||
|
||||
if (propData.type === 'array') {
|
||||
let itemType = propData.items.type;
|
||||
if (itemType === 'object') itemType = propData.items.title || 'object';
|
||||
if (itemType === 'object') {
|
||||
itemType = propData.items.title || 'object';
|
||||
propData._pointer = propData.items._pointer;
|
||||
}
|
||||
propData.type = `array of ${itemType}`;
|
||||
}
|
||||
|
||||
if (propData.type === 'object') {
|
||||
propData.type = propData.title || 'object'
|
||||
propData.type = propData.title || 'object';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user