redoc/lib/components/JsonSchema/json-schema.html

57 lines
2.9 KiB
HTML

<span *ngIf="schema.isTrivial" class="param-wrap">
<span class="param-type param-type-trivial {{schema.type}}"
[ngClass]="{'with-hint': schema._displayTypeHint}"
title="{{schema._displayTypeHint}}">{{schema._displayType}} {{schema._displayFormat}}
<span class="param-range" *ngIf="schema._range"> {{schema._range}} </span>
</span>
<div *ngIf="schema.enum" class="param-enum">
<span *ngFor="#enumItem of schema.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
</div>
</span>
<table *ngIf="!schema.isTrivial" class="params-wrap" [ngClass]="{'params-array': schema._isArray}">
<!-- <caption> {{_displayType}} </caption> -->
<template ngFor [ngForOf]="schema.properties" #prop="$implicit" #last="last">
<tr class="param" [ngClass]="{'last': last, 'discriminator': prop.isDiscriminator && !derivedEmtpy, 'complex': prop._pointer}">
<td class="param-name">
<span class="param-name-content">{{prop._name}}</span>
</td>
<td class="param-info">
<div>
<span class="param-type {{prop.type}}" [ngClass]="{'with-hint': prop._displayTypeHint}"
title="{{prop._displayTypeHint}}"> {{prop._displayType}} {{prop._displayFormat}}
<span class="param-range" *ngIf="prop._range"> {{prop._range}} </span>
</span>
<span *ngIf="prop.required" class="param-required">Required</span>
<div *ngIf="prop.enum && !prop.isDiscriminator" class="param-enum">
<span *ngFor="#enumItem of prop.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
</div>
</div>
<div class="param-description" innerHtml="{{prop.description | marked}}"></div>
<div class="discriminator-info" *ngIf="prop.isDiscriminator">
<span>This field value determines the exact schema:</span>
<dropdown (change)="selectDerived($event)">
<option *ngFor="#derived of schema.derived; #i=index"
[value]="i">{{derived.name}}</option>
</dropdown>
</div>
</td>
</tr>
<tr class="param-schema" [ngClass]="{'param-array': prop._isArray, 'last': last}" *ngIf="prop._pointer">
<td colspan="2">
<json-schema class="nested-schema" pointer="{{prop._pointer}}" [isArray]='prop._isArray'
[nestOdd]="!nestOdd" [skipReadOnly]="skipReadOnly" [attr.nesteven]="!nestOdd">
</json-schema>
</td>
</tr>
</template>
<tr *ngIf="schema.derived.length" class="param-wrap discriminator-wrap" [ngClass]="{'empty': derivedEmtpy}">
<td colspan="2">
<div class="derived-schema" *ngFor="#derived of schema.derived" [ngClass]="{active: derived.active}">
<json-schema class="discriminator-part" *ngIf="!derived.empty" [childFor]="pointer"
pointer="{{derived.$ref}}" [final]="derived.final" [skipReadOnly]="skipReadOnly">
</json-schema>
</div>
</td>
</tr>
</table>