redoc/lib/components/JsonSchema/json-schema.html
2016-06-25 13:02:13 +03:00

71 lines
3.4 KiB
HTML

<span *ngIf="schema.isFile" class="param-wrap">
<span class="param-file">file</span>
<div *ngIf="schema._produces && !isRequestSchema" class="file produces">
Produces: {{ schema._produces | json }}
</div>
<div *ngIf="schema._consumes && isRequestSchema" class="file consume">
Consumes: {{ schema._consumes | json }}
</div>
</span>
<span *ngIf="schema.isTrivial && !schema.isFile" 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="let 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" let-prop="$implicit" let-last="last">
<tr class="param" [ngClass]="{'last': last,
'discriminator': hasDescendants && !activeDescendant.empty,
'complex': prop._pointer,
'additional': prop._additional
}">
<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.default">Default: {{prop.default | json}}</div>
<div *ngIf="prop.enum && !prop.isDiscriminator" class="param-enum">
<span *ngFor="let 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>
<drop-down (change)="selectDescendant($event)">
<option *ngFor="let descendant of schema._descendants; let i=index"
[value]="i">{{descendant.name}}</option>
</drop-down>
</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" [isRequestSchema]="isRequestSchema" [attr.nesteven]="!nestOdd">
</json-schema>
</td>
</tr>
</template>
<tr *ngIf="hasDescendants" class="param-wrap discriminator-wrap">
<td colspan="2">
<div class="derived-schema" *ngFor="let descendant of schema._descendants" [ngClass]="{active: descendant.active, empty: activeDescendant.empty}">
<json-schema class="discriminator-part" *ngIf="!descendant.empty" [childFor]="pointer"
pointer="{{descendant.$ref}}" [final]="descendant.final" [isRequestSchema]="isRequestSchema">
</json-schema>
</div>
</td>
</tr>
</table>