mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 16:46:34 +03:00
Fix object to become an array (#146)
This commit is contained in:
parent
19bc9227f4
commit
c281c62b36
|
@ -17,7 +17,7 @@
|
|||
<template ngSwitchCase="trivial">
|
||||
<span class="param-wrap">
|
||||
<span class="param-type param-type-trivial {{schema.type}}"
|
||||
[ngClass]="{'with-hint': schema._displayTypeHint, 'array': schema._isArray}"
|
||||
[ngClass]="{'with-hint': schema._displayTypeHint, 'array': _isArray}"
|
||||
title="{{schema._displayTypeHint}}">{{schema._displayType}} {{schema._displayFormat}}
|
||||
<span class="param-range" *ngIf="schema._range"> {{schema._range}} </span>
|
||||
</span>
|
||||
|
@ -45,7 +45,7 @@
|
|||
[nestOdd]="!nestOdd" [isRequestSchema]="isRequestSchema"> </json-schema>
|
||||
</template>
|
||||
<template ngSwitchCase="object">
|
||||
<table class="params-wrap" [ngClass]="{'params-array': schema._isArray}">
|
||||
<table class="params-wrap" [ngClass]="{'params-array': _isArray}">
|
||||
<!-- <caption> {{_displayType}} </caption> -->
|
||||
<template ngFor [ngForOf]="properties" let-prop="$implicit" let-last="last" [ngForTrackBy]="trackByName">
|
||||
<tr class="param" [ngClass]="{'last': last,
|
||||
|
|
|
@ -84,6 +84,7 @@ export class JsonSchema extends BaseComponent implements OnInit {
|
|||
|
||||
this.schema = this.normalizer.normalize(this.schema, this.normPointer, {resolved: true});
|
||||
this.schema = SchemaHelper.unwrapArray(this.schema, this.normPointer);
|
||||
this._isArray = this.schema._isArray;
|
||||
this.initDescendants();
|
||||
this.preprocessSchema();
|
||||
}
|
||||
|
|
|
@ -265,7 +265,7 @@ export class SchemaHelper {
|
|||
if (schema && schema.type === 'array' && !Array.isArray(schema.items)) {
|
||||
let items = schema.items = schema.items || {};
|
||||
let ptr = items._pointer || JsonPointer.join(pointer, ['items']);
|
||||
res = items;
|
||||
res = Object.assign({}, items);
|
||||
res._isArray = true;
|
||||
res._pointer = ptr;
|
||||
res = SchemaHelper.unwrapArray(res, ptr);
|
||||
|
|
Loading…
Reference in New Issue
Block a user