Skip to content

Commit

Permalink
Render pattern property (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed Nov 1, 2016
1 parent 9d4a903 commit 77eeb53
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
14 changes: 14 additions & 0 deletions lib/components/JsonSchema/_json-schema-common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,20 @@ $sub-schema-offset: ($bullet-size / 2) + $bullet-margin;
}
}

.param-pattern {
color: $nullable-color;
white-space: nowrap;

&::before,
&::after {
content: '/';
margin: 0 3px;
font-size: 1.2em;
font-weight: bold;
vertical-align: bottom;
}
}

.param-default {
font-size: 0.95em;

Expand Down
4 changes: 3 additions & 1 deletion lib/components/JsonSchema/json-schema.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
</span>
<span *ngIf="schema['x-nullable']" class="param-nullable">Nullable</span>
<div *ngIf="schema.enum" class="param-enum">
<span *ngFor="let enumItem of schema.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
<span *ngFor="let enumItem of schema.enum" class="param-enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
</div>
<span *ngIf="schema.pattern" class="param-pattern">{{schema.pattern}}</span>
</span>
</template>
<template ngSwitchCase="tuple">
Expand Down Expand Up @@ -78,6 +79,7 @@
<div *ngIf="prop.enum && !prop.isDiscriminator" class="param-enum">
<span *ngFor="let enumItem of prop.enum" class="param-enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
</div>
<span *ngIf="prop.pattern" class="param-pattern">{{prop.pattern}}</span>
</div>
<div class="param-description" [innerHtml]="prop.description | marked"></div>
<div class="discriminator-info" *ngIf="prop.isDiscriminator">
Expand Down
7 changes: 5 additions & 2 deletions lib/components/ParamsList/params-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ <h5 class="param-list-header" *ngIf="params.length"> Parameters </h5>
title="{{param._displayTypeHint}}"> {{param._displayType}} {{param._displayFormat}}</span>
<span class="param-range" *ngIf="param._range"> {{param._range}} </span>
<span *ngIf="param.required" class="param-required">Required</span>
<div class="param-default" *ngIf="param.default != null">{{param.default | json}}</div>
<div class="param-default" *ngIf="param.default != null">
<span class="param-default-value">{{param.default | json}}</span>
</div>
<div *ngIf="param.enum" class="param-enum">
<span *ngFor="let enumItem of param.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
<span *ngFor="let enumItem of param.enum" class="param-enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
</div>
<span *ngIf="param.pattern" class="param-pattern">{{param.pattern}}</span>
</div>
<div class="param-description" [innerHtml]="param.description | marked"></div>
</div>
Expand Down

0 comments on commit 77eeb53

Please sign in to comment.