mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-23 00:56:33 +03:00
schema ui fixes
This commit is contained in:
parent
afb9f6b1ed
commit
abefb06dd5
|
@ -22,7 +22,7 @@
|
|||
<div *ngIf="data.derived.length" class="param-wrap">
|
||||
<tabs>
|
||||
<tab *ngFor="#derived of data.derived" tabTitle="{{derived.name}}">
|
||||
<json-schema pointer="{{derived.$ref}}" [final]="derived.final" [isArray]='isArray'>
|
||||
<json-schema pointer="{{derived.$ref}}" [final]="derived.final">
|
||||
</json-schema>
|
||||
</tab>
|
||||
</tabs>
|
||||
|
|
|
@ -33,6 +33,9 @@ export default class JsonSchema extends BaseComponent {
|
|||
|
||||
if (schema.type === 'array') {
|
||||
this.isArray = true;
|
||||
if (schema._pointer) {
|
||||
this.pointer = JsonPointer.join(schema._pointer, 'items');
|
||||
}
|
||||
schema = schema.items;
|
||||
}
|
||||
let normPtr = schema._pointer || this.pointer;
|
||||
|
@ -43,9 +46,7 @@ export default class JsonSchema extends BaseComponent {
|
|||
}
|
||||
|
||||
this.joinAllOf(schema, {omitParent: true});
|
||||
if (!schema.type) {
|
||||
schema.type = 'object';
|
||||
}
|
||||
|
||||
if (schema.type !== 'object') {
|
||||
this.isTrivial = true;
|
||||
this._displayType = schema.type;
|
||||
|
@ -69,7 +70,7 @@ export default class JsonSchema extends BaseComponent {
|
|||
let discriminatorFieldIdx = -1;
|
||||
let props = Object.keys(schema.properties).map((prop, idx) => {
|
||||
let propData = schema.properties[prop];
|
||||
this.injectPropData(prop, propData);
|
||||
this.injectPropData(prop, propData, schema);
|
||||
if (propData.isDiscriminator) discriminatorFieldIdx = idx;
|
||||
return propData;
|
||||
});
|
||||
|
@ -95,11 +96,11 @@ export default class JsonSchema extends BaseComponent {
|
|||
if (discrValues) discrValues.style.paddingLeft = maxWidth + 'px';
|
||||
}
|
||||
|
||||
injectPropData(prop, propData) {
|
||||
injectPropData(prop, propData, schema) {
|
||||
propData._name = prop;
|
||||
propData.isRequired = this.requiredMap[prop];
|
||||
propData._displayType = propData.type;
|
||||
propData.isDiscriminator = (this.componentSchema.discriminator === prop);
|
||||
propData.isDiscriminator = (schema.discriminator === prop);
|
||||
if (propData.type === 'array') {
|
||||
let itemType = propData.items.type;
|
||||
let itemFormat = propData.items.format;
|
||||
|
|
Loading…
Reference in New Issue
Block a user