mirror of
https://github.com/Redocly/redoc.git
synced 2025-01-31 01:54:08 +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';
|
'use strict';
|
||||||
|
|
||||||
import {JsonPointer} from '../../utils/JsonPointer';
|
|
||||||
import {RedocComponent, BaseComponent} from '../base';
|
import {RedocComponent, BaseComponent} from '../base';
|
||||||
import {ElementRef} from 'angular2/angular2';
|
import {ElementRef} from 'angular2/angular2';
|
||||||
|
|
||||||
|
@ -29,11 +28,12 @@ export default class JsonSchema extends BaseComponent {
|
||||||
// TODO
|
// TODO
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!schema.properties) return;
|
||||||
let props = Object.keys(schema.properties).map(prop => {
|
let props = Object.keys(schema.properties).map(prop => {
|
||||||
let propData = schema.properties[prop];
|
let propData = schema.properties[prop];
|
||||||
this.injectPropData(prop, propData);
|
this.injectPropData(prop, propData);
|
||||||
return propData;
|
return propData;
|
||||||
})
|
});
|
||||||
this.data.properties = props;
|
this.data.properties = props;
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,12 +55,15 @@ export default class JsonSchema extends BaseComponent {
|
||||||
|
|
||||||
if (propData.type === 'array') {
|
if (propData.type === 'array') {
|
||||||
let itemType = propData.items.type;
|
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}`;
|
propData.type = `array of ${itemType}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (propData.type === 'object') {
|
if (propData.type === 'object') {
|
||||||
propData.type = propData.title || 'object'
|
propData.type = propData.title || 'object';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user