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

83 lines
4.1 KiB
HTML
Raw Normal View History

2016-05-16 23:02:23 +03:00
<span *ngIf="schema.isFile" class="param-wrap">
2016-07-01 18:10:01 +03:00
<span class="param-type-file">file</span>
2016-05-16 23:02:23 +03:00
<div *ngIf="schema._produces && !isRequestSchema" class="file produces">
2016-07-01 18:10:01 +03:00
<ul>
<li *ngFor="let type of schema._produces">{{type}}</li>
</ul>
2016-05-16 23:02:23 +03:00
</div>
<div *ngIf="schema._consumes && isRequestSchema" class="file consume">
2016-07-01 18:10:01 +03:00
<ul>
<li *ngFor="let type of schema._consumes">{{type}}</li>
</ul>
2016-05-16 23:02:23 +03:00
</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">
2016-04-29 22:57:24 +03:00
<span *ngFor="let enumItem of schema.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
</div>
</span>
2016-06-30 16:42:36 +03:00
<table *ngIf="!schema.isTrivial" class="params-wrap" [ngClass]="{'params-array': _isArray}">
2016-04-07 20:59:59 +03:00
<!-- <caption> {{_displayType}} </caption> -->
2016-06-30 16:42:36 +03:00
<template ngFor [ngForOf]="properties" let-prop="$implicit" let-last="last" [ngForTrackBy]="trackByIdx">
<tr class="param" [ngClass]="{'last': last,
2016-06-30 16:42:36 +03:00
'discriminator': prop.isDiscriminator && !activeDescendant.empty,
'complex': prop._pointer,
'additional': prop._additional,
'expanded': subSchema.visible
}">
2016-03-09 01:27:19 +03:00
<td class="param-name">
2016-07-10 14:42:49 +03:00
<span class="param-name-wrap" (click)="subSchema.toggle()">
<span class="param-name-content" >{{prop._name}}</span>
<svg *ngIf="prop._pointer" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0" y="0" viewBox="0 0 24 24" xml:space="preserve">
<polygon points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 "/>
</svg>
</span>
2016-03-09 01:27:19 +03:00
</td>
<td class="param-info">
2015-11-19 00:23:18 +03:00
<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>
2016-06-25 13:02:13 +03:00
<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">
2016-04-29 22:57:24 +03:00
<span *ngFor="let enumItem of prop.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
2016-02-06 18:00:31 +03:00
</div>
2015-11-19 00:23:18 +03:00
</div>
2016-06-22 19:13:57 +03:00
<div class="param-description" [innerHtml]="prop.description | marked"></div>
2016-03-18 16:06:22 +03:00
<div class="discriminator-info" *ngIf="prop.isDiscriminator">
2016-04-13 14:26:59 +03:00
<span>This field value determines the exact schema:</span>
2016-06-22 21:17:48 +03:00
<drop-down (change)="selectDescendant($event)">
<option *ngFor="let descendant of schema._descendants; let i=index"
[value]="i">{{descendant.name}}</option>
</drop-down>
2016-03-18 16:06:22 +03:00
</div>
2016-03-09 01:27:19 +03:00
</td>
</tr>
<tr class="param-schema" [ngClass]="{'param-array': prop._isArray, 'last': last}" [hidden]="!prop._pointer">
2016-03-09 01:27:19 +03:00
<td colspan="2">
2016-07-10 14:28:05 +03:00
<zippy #subSchema title="Expand" [headless]="true" (open)="lazySchema.load()" [visible]="autoExpand">
<json-schema-lazy #lazySchema [auto]="autoExpand" class="nested-schema" [pointer]="prop._pointer" [isArray]='prop._isArray'
[nestOdd]="!nestOdd" [isRequestSchema]="isRequestSchema">
</json-schema-lazy>
</zippy>
2016-03-09 01:27:19 +03:00
</td>
</tr>
</template>
2016-06-30 16:42:36 +03:00
<tr *ngIf="hasDescendants" class="param-wrap discriminator-wrap" [ngClass]="{empty:activeDescendant.empty}">
2016-03-09 01:27:19 +03:00
<td colspan="2">
2016-06-30 16:42:36 +03:00
<div class="derived-schema" *ngFor="let descendant of schema._descendants" [ngClass]="{active: descendant.active, empty: descendant.empty}">
2016-06-22 21:17:48 +03:00
<json-schema class="discriminator-part" *ngIf="!descendant.empty" [childFor]="pointer"
pointer="{{descendant.$ref}}" [final]="descendant.final" [isRequestSchema]="isRequestSchema">
2016-03-18 16:06:22 +03:00
</json-schema>
</div>
2016-03-09 01:27:19 +03:00
</td>
</tr>
</table>