support "x-nullable" property

This commit is contained in:
kedashoe 2016-08-31 11:35:51 -07:00
parent 22eff033e3
commit 027cdc19c8
4 changed files with 11 additions and 0 deletions

View File

@ -819,6 +819,7 @@ definitions:
type: string
pattern: "^\\+(?:[0-9]-?){6,14}[0-9]$"
example: +1-202-555-0192
x-nullable: true
userStatus:
description: User status
type: integer

View File

@ -63,6 +63,14 @@ $sub-schema-offset: ($bullet-size / 2) + $bullet-margin;
font-weight: bold;
}
.param-nullable {
vertical-align: middle;
line-height: $param-name-height;
color: #3195a6;
font-size: 12px;
font-weight: bold;
}
.param-type {
vertical-align: middle;
line-height: $param-name-height;

View File

@ -70,6 +70,7 @@
<span class="param-range" *ngIf="prop._range"> {{prop._range}} </span>
</span>
<span *ngIf="prop._required" class="param-required">Required</span>
<span *ngIf="prop._nullable" class="param-nullable">Nullable</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>

View File

@ -229,6 +229,7 @@ export class SchemaHelper {
propertySchema._pointer = null;
}
propertySchema._required = !!requiredMap[propName];
propertySchema._nullable = !!propertySchema['x-nullable'];
propertySchema.isDiscriminator = (schema.discriminator === propName);
return propertySchema;
});