mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-23 00:56:33 +03:00
Fix crashing on array without items (fixes #104)
This commit is contained in:
parent
2ac8b3af3c
commit
0a939d1548
|
@ -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}"
|
||||
[ngClass]="{'with-hint': schema._displayTypeHint, 'array': schema._isArray}"
|
||||
title="{{schema._displayTypeHint}}">{{schema._displayType}} {{schema._displayFormat}}
|
||||
<span class="param-range" *ngIf="schema._range"> {{schema._range}} </span>
|
||||
</span>
|
||||
|
|
|
@ -262,8 +262,9 @@ export class SchemaHelper {
|
|||
static unwrapArray(schema, pointer) {
|
||||
var res = schema;
|
||||
if (schema && schema.type === 'array' && !Array.isArray(schema.items)) {
|
||||
let ptr = schema.items._pointer || JsonPointer.join(pointer, ['items']);
|
||||
res = schema.items;
|
||||
let items = schema.items = schema.items || {};
|
||||
let ptr = items._pointer || JsonPointer.join(pointer, ['items']);
|
||||
res = items;
|
||||
res._isArray = true;
|
||||
res._pointer = ptr;
|
||||
res = SchemaHelper.unwrapArray(res, ptr);
|
||||
|
|
Loading…
Reference in New Issue
Block a user