Skip to content

Commit

Permalink
Merge pull request #95 from kedashoe/x-nullable
Browse files Browse the repository at this point in the history
support "x-nullable" property
  • Loading branch information
RomanHotsiy authored Aug 31, 2016
2 parents 22eff03 + 027cdc1 commit 3d3bcbe
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions demo/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions lib/components/JsonSchema/_json-schema-common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions lib/components/JsonSchema/json-schema.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions lib/services/schema-helper.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down

0 comments on commit 3d3bcbe

Please sign in to comment.